Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: Adjusted Navigation paddings to make Collapsable and Non Colla… #952

Merged
merged 1 commit into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
.navigationGroup {
&:not(.collapsable) ul {
padding: var(--accordion--content-padding);
}
&:not(:last-child) {
margin-bottom: var(--menu--group-to-group-spacing);
}

.label {
display: block;
margin-block: var(--menu--label-to-group-spacing);
padding-inline-start: var(--accordion--header-padding-x);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ export interface NavigationGroupProps
export const NavigationGroup: FC<NavigationGroupProps> = (props) => {
const { children, className, collapsable, ...rest } = props;

const rootClassName = clsx(styles.navigationGroup, className);
const rootClassName = clsx(
styles.navigationGroup,
collapsable && styles.collapsable,
className,
);

const generatedId = useId();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,30 @@ export const WithCollapsableGroups: Story = {
</Navigation>
),
};
export const MixedGroups: Story = {
render: (props) => (
<Navigation aria-label="Main navigation" {...props}>
<NavigationGroup collapsable>
<Label>General</Label>
<Link href="#">Dashboard</Link>
<Link href="#" aria-current="page">
Performance
</Link>
</NavigationGroup>

<NavigationGroup>
<Label>General</Label>
<Link href="#">Apps</Link>
<Link href="#">Databases</Link>
<Link href="#">Domains</Link>
</NavigationGroup>

<NavigationGroup collapsable>
<Label>Components</Label>
<Link href="#">Testsite</Link>
<Link href="#">Testsite</Link>
<Link href="#">Testsite</Link>
</NavigationGroup>
</Navigation>
),
};
2 changes: 1 addition & 1 deletion packages/design-tokens/src/actions/menu-item.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ menu:
group-to-group-spacing:
value: "{size-px.m}"
label-to-group-spacing:
value: "{size-px.s}"
value: "{size-px.xs}"
separator-to-item-spacing:
value: "{size-px.s}"

Expand Down