Skip to content

Commit 04b017a

Browse files
NicolappsConvex, Inc.
authored andcommitted
Fix nested button in Sidebar (#36687)
GitOrigin-RevId: 88b79cc7042019797ffb99ffcc3b642c2e14c072
1 parent 00fd340 commit 04b017a

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

npm-packages/dashboard-common/src/elements/Sidebar.tsx

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
DoubleArrowLeftIcon,
88
DoubleArrowRightIcon,
99
} from "@radix-ui/react-icons";
10-
import { Tooltip } from "@ui/Tooltip";
10+
import { TooltipSide } from "@ui/Tooltip";
1111
import { Button } from "@ui/Button";
1212

1313
export type SidebarItem = {
@@ -62,21 +62,23 @@ export function Sidebar({
6262
<div key={group.key} className="flex gap-1 sm:flex-col sm:py-2">
6363
{group.items.map((item) => (
6464
<div className="relative h-[1.875rem]" key={item.key}>
65-
<Tooltip
66-
tip={item.tooltip ? item.tooltip : collapsed && item.label}
67-
side={width > 640 ? "right" : "bottom"}
68-
className="text-left"
65+
<SidebarLink
66+
{...omit(item, "key")}
67+
collapsed={collapsed}
68+
isActive={currentPage === item.key}
69+
disabled={item.disabled}
70+
small
71+
tip={
72+
item.tooltip
73+
? item.tooltip
74+
: collapsed
75+
? item.label
76+
: undefined
77+
}
78+
tipSide={width > 640 ? "right" : "bottom"}
6979
>
70-
<SidebarLink
71-
{...omit(item, "key")}
72-
collapsed={collapsed}
73-
isActive={currentPage === item.key}
74-
disabled={item.disabled}
75-
small
76-
>
77-
{item.label}
78-
</SidebarLink>
79-
</Tooltip>
80+
{item.label}
81+
</SidebarLink>
8082
</div>
8183
))}
8284
</div>
@@ -114,6 +116,7 @@ export function SidebarLink({
114116
proBadge,
115117
small,
116118
tip,
119+
tipSide,
117120
target,
118121
}: {
119122
collapsed?: boolean;
@@ -126,12 +129,14 @@ export function SidebarLink({
126129
proBadge?: boolean;
127130
small?: boolean;
128131
tip?: string;
132+
tipSide?: TooltipSide;
129133
target?: "_blank";
130134
}) {
131135
const { query: currentQuery } = useRouter();
132136
return (
133137
<Button
134138
tip={tip}
139+
tipSide={tipSide}
135140
variant="unstyled"
136141
href={
137142
disabled

0 commit comments

Comments
 (0)