diff --git a/src/fragments/sidebar/Sidebar.stories.tsx b/src/fragments/sidebar/Sidebar.stories.tsx index 147e1ec..be0faac 100644 --- a/src/fragments/sidebar/Sidebar.stories.tsx +++ b/src/fragments/sidebar/Sidebar.stories.tsx @@ -1,6 +1,7 @@ import type { Meta, StoryObj } from "@storybook/react"; import { Button, Card, Input } from "@nextui-org/react"; import { + IconBell, IconBox, IconBoxMultiple, IconCirclePlus, @@ -102,6 +103,13 @@ export const Primary: Story = { label: "Chat", link: "/chat", icon: , + badgeContent: '', + }, + { + label: "Notifications", + link: "/notifications", + icon: , + badgeContent: '9+', }, ], }, diff --git a/src/fragments/sidebar/Sidebar.tsx b/src/fragments/sidebar/Sidebar.tsx index c6271cf..402f395 100644 --- a/src/fragments/sidebar/Sidebar.tsx +++ b/src/fragments/sidebar/Sidebar.tsx @@ -3,7 +3,9 @@ import { Avatar, AvatarProps, + Badge, Button, + Chip, Dropdown, DropdownItem, DropdownItemProps, @@ -33,6 +35,7 @@ interface SidebarNavigationItem { onClick?: React.MouseEventHandler; icon?: React.ReactNode; endContent?: React.ReactNode; + badgeContent?: React.ReactNode; items?: SidebarItemVariants[]; } @@ -100,7 +103,7 @@ const renderItems = (item: SidebarProps['items'][number], options: { layout: Sid {navItem.badgeContent} : navItem.endContent} href={navItem.link} className={options.activeNav?.link === navItem.link ? "bg-default/40 text-default-foreground" : ''} > @@ -121,11 +124,13 @@ const renderItems = (item: SidebarProps['items'][number], options: { layout: Sid variant={options.activeNav?.link === navItem.link ? 'flat' : 'light'} size="lg" as="a" - startContent={navItem.icon} href={navItem.link} isIconOnly - - /> + > + + {navItem.icon} + + ))} @@ -210,9 +215,9 @@ export const Sidebar: React.FC = ({ items, layout = 'expanded', au const collapseButtonStyles = collapsed ? 'left-20 translate-x-1/2 rotate-180' : 'left-72 -translate-x-1/2'; return ( - - - + + + {items.map((item) => { const children = item.align !== 'bottom' ? renderItems(item, { layout: 'collapsed', activeNav }) : null; return children ? ( @@ -233,8 +238,8 @@ export const Sidebar: React.FC = ({ items, layout = 'expanded', au })} - - + + {items.map((item) => { const children = item.align !== 'bottom' ? renderItems(item, { layout: 'expanded', activeNav }) : null; return children ? (