🐛 Add onClose
to SidebarItems
(#589)
This commit is contained in:
@@ -23,7 +23,7 @@ const Sidebar: React.FC = () => {
|
|||||||
<Flex flexDir="column" justify="space-between" h="100%">
|
<Flex flexDir="column" justify="space-between" h="100%">
|
||||||
<Box>
|
<Box>
|
||||||
<Image src={Logo} alt="Logo" />
|
<Image src={Logo} alt="Logo" />
|
||||||
<SidebarItems />
|
<SidebarItems onClose={onClose} />
|
||||||
</Box>
|
</Box>
|
||||||
<UserInfo />
|
<UserInfo />
|
||||||
</Flex>
|
</Flex>
|
||||||
|
@@ -12,12 +12,16 @@ const items = [
|
|||||||
{ icon: FiLogOut, title: 'Log out' }
|
{ icon: FiLogOut, title: 'Log out' }
|
||||||
];
|
];
|
||||||
|
|
||||||
const SidebarItems: React.FC = () => {
|
interface SidebarItemsProps {
|
||||||
|
onClose?: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const SidebarItems: React.FC<SidebarItemsProps> = ({ onClose }) => {
|
||||||
const listItems = items.map((item) => (
|
const listItems = items.map((item) => (
|
||||||
<Flex w="100%" p={2} key={item.title} _hover={{
|
<Flex w="100%" p={2} key={item.title} _hover={{
|
||||||
background: "gray.200",
|
background: "gray.200",
|
||||||
borderRadius: "12px",
|
borderRadius: "12px",
|
||||||
}}>
|
}} onClick={onClose}>
|
||||||
<Link to={item.path || "/"}>
|
<Link to={item.path || "/"}>
|
||||||
<Flex color="teal.500" gap={4}>
|
<Flex color="teal.500" gap={4}>
|
||||||
<Icon as={item.icon} alignSelf="center" />
|
<Icon as={item.icon} alignSelf="center" />
|
||||||
|
Reference in New Issue
Block a user