Skip to content

Commit f3f3958

Browse files
committed
fix(component-library): fix main nav tabs selectable state
1 parent 86909dd commit f3f3958

File tree

2 files changed

+14
-22
lines changed

2 files changed

+14
-22
lines changed

packages/component-library/src/MainNavTabs/index.module.scss

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -34,28 +34,18 @@
3434
&[data-selected] {
3535
color: theme.color("button", "solid", "foreground");
3636
pointer-events: none;
37+
}
38+
}
3739

38-
&[data-selectable] {
39-
pointer-events: auto;
40-
41-
&[data-hovered] .bubble {
42-
background-color: theme.color(
43-
"button",
44-
"solid",
45-
"background",
46-
"hover"
47-
);
48-
}
49-
50-
&[data-pressed] .bubble {
51-
background-color: theme.color(
52-
"button",
53-
"solid",
54-
"background",
55-
"active"
56-
);
57-
}
58-
}
40+
&[data-selectable] .tab[data-selected] {
41+
pointer-events: auto;
42+
43+
&[data-hovered] .bubble {
44+
background-color: theme.color("button", "solid", "background", "hover");
45+
}
46+
47+
&[data-pressed] .bubble {
48+
background-color: theme.color("button", "solid", "background", "active");
5949
}
6050
}
6151
}

packages/component-library/src/MainNavTabs/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ export const MainNavTabs = ({ className, pathname, ...props }: Props) => {
2121
aria-label="Main Navigation"
2222
className={clsx(styles.mainNavTabs, className)}
2323
dependencies={[pathname]}
24+
data-selectable={
25+
props.items.every((tab) => tab.href !== pathname) ? "" : undefined
26+
}
2427
{...props}
2528
>
2629
{({ className: tabClassName, children, ...tab }) => (
@@ -29,7 +32,6 @@ export const MainNavTabs = ({ className, pathname, ...props }: Props) => {
2932
data-size="sm"
3033
data-variant="ghost"
3134
data-rounded
32-
data-selectable={pathname === tab.href ? undefined : ""}
3335
{...tab}
3436
>
3537
{(args) => (

0 commit comments

Comments
 (0)