Skip to content

Commit f726497

Browse files
authored
Display icons on sidebar sub-menu items. (#5872)
1 parent 9508b80 commit f726497

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

changelog/+icon-sub-menu.added.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
In the sidebar, sub-menu items now support icons.

frontend/app/src/shared/components/layout/menu-navigation/components/menu-section-internal.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,20 @@ const RecursiveInternalMenuItem: React.FC<{ item: MenuItem }> = ({ item }) => {
2525
if (!item.children?.length) {
2626
return (
2727
<DropdownMenuItem asChild>
28-
<Link to={constructPath(item.path)}>{item.label}</Link>
28+
<Link to={constructPath(item.path)}>
29+
<Icon icon={item.icon} className="min-w-4" />
30+
{item.label}
31+
</Link>
2932
</DropdownMenuItem>
3033
);
3134
}
3235

3336
return (
3437
<DropdownMenuSub>
35-
<DropdownMenuSubTrigger>{item.label}</DropdownMenuSubTrigger>
38+
<DropdownMenuSubTrigger>
39+
<Icon icon={item.icon} className="min-w-4" />
40+
{item.label}
41+
</DropdownMenuSubTrigger>
3642
<DropdownMenuSubContent>
3743
{item.children.map((childItem) => (
3844
<RecursiveInternalMenuItem key={childItem.identifier} item={childItem} />

frontend/app/src/shared/components/ui/dropdown-menu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export const DropdownMenuSubTrigger = forwardRef<
7575
<DropdownMenuPrimitive.SubTrigger
7676
ref={ref}
7777
className={classNames(
78-
"flex cursor-default select-none items-center rounded-lg p-2 text-sm outline-none focus:bg-neutral-100 data-[state=open]:bg-neutral-100",
78+
"flex gap-1.5 cursor-default select-none items-center rounded-lg p-2 text-sm outline-none focus:bg-neutral-100 data-[state=open]:bg-neutral-100",
7979
className
8080
)}
8181
{...props}

0 commit comments

Comments
 (0)