Skip to content
This repository was archived by the owner on Feb 19, 2025. It is now read-only.

Commit 64dbca3

Browse files
authored
Merge pull request #129 from supabase/fix/menu-bar-styling
fix: menu styling, background color, added new left bar active border…
2 parents c424f1f + 6a49d7a commit 64dbca3

File tree

3 files changed

+55
-2
lines changed

3 files changed

+55
-2
lines changed

src/components/Menu/Menu.module.css

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,20 @@
1212

1313
.sbui-menu__item--active {
1414
@apply bg-gray-100;
15-
@apply dark:bg-dark-800;
15+
@apply dark:bg-dark-900;
16+
17+
@apply text-gray-900;
18+
@apply dark:text-white;
19+
}
20+
21+
.sbui-menu__item--active .sbui-menu__content {
22+
@apply text-gray-900;
23+
@apply dark:text-white;
24+
}
25+
26+
.sbui-menu__item--active--bar {
27+
@apply border-l-4 border-brand-500;
28+
border-left-style: solid;
1629
}
1730

1831
.sbui-menu__item--rounded {

src/components/Menu/Menu.stories.tsx

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,42 @@ export const withRounded = (args: any) => (
4646
</Menu>
4747
)
4848

49+
export const withGroupTitles = () => (
50+
<Menu>
51+
<Menu.Group title="First group" />
52+
<Menu.Item rounded icon={<IconMail />}>
53+
Account settings
54+
</Menu.Item>
55+
<Menu.Item rounded icon={<IconMail />}>
56+
Account settings
57+
</Menu.Item>
58+
<Menu.Item rounded icon={<IconMail />}>
59+
Account settings
60+
</Menu.Item>
61+
<Menu.Group title="Second group" />
62+
<Menu.Item rounded icon={<IconMail />}>
63+
Account settings
64+
</Menu.Item>
65+
<Menu.Item rounded icon={<IconMail />}>
66+
Account settings
67+
</Menu.Item>
68+
</Menu>
69+
)
70+
71+
export const withActiveBar = () => (
72+
<Menu>
73+
<Menu.Group title="First group" />
74+
<Menu.Item icon={<IconMail />}>Account settings</Menu.Item>
75+
<Menu.Item active showActiveBar icon={<IconMail />}>
76+
Account settings
77+
</Menu.Item>
78+
<Menu.Item icon={<IconMail />}>Account settings</Menu.Item>
79+
<Menu.Group title="Second group" />
80+
<Menu.Item icon={<IconMail />}>Account settings</Menu.Item>
81+
<Menu.Item icon={<IconMail />}>Account settings</Menu.Item>
82+
</Menu>
83+
)
84+
4985
Default.args = {
5086
title: 'I am a title',
5187
titleExtra: <Typography.Link>Learn more</Typography.Link>,

src/components/Menu/Menu.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ interface ItemProps {
2121
rounded?: boolean
2222
onClick?: any
2323
doNotCloseOverlay?: boolean
24+
showActiveBar?: boolean
2425
}
2526

2627
export function Item({
@@ -30,9 +31,12 @@ export function Item({
3031
rounded,
3132
onClick,
3233
doNotCloseOverlay = false,
34+
showActiveBar = false,
3335
}: ItemProps) {
3436
let classes = [MenuStyles['sbui-menu__item']]
3537
if (active) classes.push(MenuStyles['sbui-menu__item--active'])
38+
if (active && showActiveBar)
39+
classes.push(MenuStyles['sbui-menu__item--active--bar'])
3640
if (rounded) classes.push(MenuStyles['sbui-menu__item--rounded'])
3741

3842
const itemOnClick = onClick
@@ -69,7 +73,7 @@ export function Item({
6973
}
7074

7175
interface GroupProps {
72-
children: React.ReactNode
76+
children?: React.ReactNode
7377
icon?: React.ReactNode
7478
title: string
7579
}

0 commit comments

Comments
 (0)