1+ import { Box , Flex , IconButton , Text } from "@chakra-ui/react"
2+ import { useQueryClient } from "@tanstack/react-query"
3+ import { useState } from "react"
4+ import { FaBars } from "react-icons/fa"
5+
6+ import { FiLogOut } from "react-icons/fi"
7+ import type { UserPublic } from "../../client"
8+ import useAuth from "../../hooks/useAuth"
19import {
2- Box ,
310 DrawerBackdrop ,
411 DrawerBody ,
512 DrawerCloseTrigger ,
613 DrawerContent ,
714 DrawerRoot ,
815 DrawerTrigger ,
9- Flex ,
10- IconButton ,
11- Text ,
12- } from "@chakra-ui/react"
13- import { useQueryClient } from "@tanstack/react-query"
14-
15- import { FaBars , FaSignOutAlt } from "react-icons/fa"
16- import type { UserPublic } from "../../client"
17- import useAuth from "../../hooks/useAuth"
16+ } from "../ui/drawer"
1817import SidebarItems from "./SidebarItems"
1918
2019const Sidebar = ( ) => {
2120 const queryClient = useQueryClient ( )
2221 const currentUser = queryClient . getQueryData < UserPublic > ( [ "currentUser" ] )
2322 const { logout } = useAuth ( )
23+ const [ open , setOpen ] = useState ( false )
2424
2525 const handleLogout = async ( ) => {
2626 logout ( )
@@ -29,7 +29,11 @@ const Sidebar = () => {
2929 return (
3030 < >
3131 { /* Mobile */ }
32- < DrawerRoot size = "sm" placement = "start" >
32+ < DrawerRoot
33+ placement = "start"
34+ open = { open }
35+ onOpenChange = { ( e ) => setOpen ( e . open ) }
36+ >
3337 < DrawerBackdrop />
3438 < DrawerTrigger asChild >
3539 < IconButton
@@ -38,7 +42,7 @@ const Sidebar = () => {
3842 display = { { base : "flex" , md : "none" } }
3943 aria-label = "Open Menu"
4044 position = "absolute"
41- fontSize = "20px "
45+ zIndex = "100 "
4246 m = { 4 }
4347 >
4448 < FaBars />
@@ -58,7 +62,7 @@ const Sidebar = () => {
5862 px = { 4 }
5963 py = { 2 }
6064 >
61- < FaSignOutAlt />
65+ < FiLogOut />
6266 < Text > Log Out</ Text >
6367 </ Flex >
6468 </ Box >
@@ -79,7 +83,7 @@ const Sidebar = () => {
7983 display = { { base : "none" , md : "flex" } }
8084 position = "sticky"
8185 bg = "bg.subtle"
82- top = "0"
86+ top = { 0 }
8387 minW = "280px"
8488 h = "100vh"
8589 p = { 4 }
0 commit comments