Skip to content

Commit

Permalink
🐛 Add onClose to SidebarItems (fastapi#589)
Browse files Browse the repository at this point in the history
  • Loading branch information
alejsdev authored Jan 29, 2024
1 parent bfbb180 commit 39f49d5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/new-frontend/src/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const Sidebar: React.FC = () => {
<Flex flexDir="column" justify="space-between" h="100%">
<Box>
<Image src={Logo} alt="Logo" />
<SidebarItems />
<SidebarItems onClose={onClose} />
</Box>
<UserInfo />
</Flex>
Expand Down
8 changes: 6 additions & 2 deletions src/new-frontend/src/components/SidebarItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,16 @@ const items = [
{ icon: FiLogOut, title: 'Log out' }
];

const SidebarItems: React.FC = () => {
interface SidebarItemsProps {
onClose?: () => void;
}

const SidebarItems: React.FC<SidebarItemsProps> = ({ onClose }) => {
const listItems = items.map((item) => (
<Flex w="100%" p={2} key={item.title} _hover={{
background: "gray.200",
borderRadius: "12px",
}}>
}} onClick={onClose}>
<Link to={item.path || "/"}>
<Flex color="teal.500" gap={4}>
<Icon as={item.icon} alignSelf="center" />
Expand Down

0 comments on commit 39f49d5

Please sign in to comment.