Skip to content

Commit 1a75ab5

Browse files
committed
--wip-- [skip ci]
1 parent 2b2539b commit 1a75ab5

File tree

5 files changed

+35
-18
lines changed

5 files changed

+35
-18
lines changed

src/components/layout/sidebar-navigation/SidebarNavigation.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ const SidebarNavigationWrapper = styled.nav`
9999
100100
--sidebar-navigation-width: ${cssVar('layout-sidebar-navigation-sizes-width-open')};
101101
102-
// hover and focus-within pilotes the open state of the sidebar
102+
// hover and focus-within pilots the open state of the sidebar
103103
[data-sidebar-docked='false'] &:not(:hover, :focus-within) {
104104
--sidebar-navigation-width: ${cssVar('layout-sidebar-navigation-sizes-width-closed')};
105105
}

src/components/layout/sidebar-navigation/SidebarNavigationAccordionItem.tsx

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -163,41 +163,40 @@ const AccordionItem = styled.button`
163163
AccordionItem.displayName = 'AccordionItem';
164164

165165
const AccordionItemPanel = styled.section`
166-
margin-left: ${cssVar('dimension-space-300')};
166+
margin-left: ${cssVar('dimension-space-200')};
167167
padding-left: ${cssVar('dimension-space-100')};
168168
padding-right: ${cssVar('dimension-space-100')};
169169
border-left: ${cssVar('border-width-default')} solid ${cssVar('color-border-weak')};
170170
171171
// The children SidebarNavigationItems rely on this css property to set their display value, falling
172172
// back to flex if not inside an accordion
173173
--sidebar-navigation-accordion-children-display: flex;
174-
--sidebar-navigation-accordion-children-gap: ${cssVar('dimension-space-50')};
174+
--sidebar-navigation-accordion-children-visibility: visible;
175175
176-
// The next two rules hide the child SidebarNavigationItems when the accordion is closed, and also
177-
// when the sidebar is neither docked nor open (hovered or focused).
176+
// The rule hide the child SidebarNavigationItems when the accordion is closed
178177
&[data-accordion-open='false'] {
179178
--sidebar-navigation-accordion-children-display: none;
180-
--sidebar-navigation-accordion-children-gap: ${cssVar('dimension-space-0')};
181179
}
182180
181+
// This rule changes the way the SidebarNavigationItems looks like when the accordion is open but the sidebar is collapsed
183182
[data-sidebar-docked='false'] nav:not(:hover, :focus-within) & {
184-
margin: 0;
185-
padding: 0;
186-
border-left: none;
187-
188-
--sidebar-navigation-accordion-children-display: none;
189-
--sidebar-navigation-accordion-children-gap: ${cssVar('dimension-space-0')};
183+
--sidebar-navigation-accordion-children-visibility: hidden;
190184
}
191185
`;
192186

193187
AccordionItemPanel.displayName = 'AccordionItemPanel';
194188

195-
export const AccordionItemsList = styled.ul`
189+
const AccordionItemsList = styled.ul`
196190
all: unset;
197191
198192
display: flex;
199193
flex-direction: column;
200-
gap: var(--sidebar-navigation-accordion-children-gap);
194+
gap: ${cssVar('dimension-space-50')};
195+
196+
[data-sidebar-docked='false'] nav:not(:hover, :focus-within) & {
197+
margin-left: calc(-1 * ${cssVar('dimension-space-300')});
198+
width: ${cssVar('dimension-width-400')};
199+
}
201200
`;
202201

203202
AccordionItemsList.displayName = 'AccordionItemsList';

src/components/layout/sidebar-navigation/SidebarNavigationBody.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ SidebarNavigationBodyInner.displayName = 'SidebarNavigationBodyInner';
8282

8383
const SidebarNavigationBottomShadowScroll = styled(BottomShadowScroll)`
8484
[data-sidebar-docked='false'] nav:not(:hover, :focus-within) & {
85-
display: none;
85+
opacity: 0.5;
8686
}
8787
`;
8888
SidebarNavigationBottomShadowScroll.displayName = 'SidebarNavigationBottomShadowScroll';

src/components/layout/sidebar-navigation/SidebarNavigationGroup.tsx

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import styled from '@emotion/styled';
2222
import { forwardRef, PropsWithChildren, useId } from 'react';
2323
import { TextNode } from '~types/utils';
2424
import { cssVar } from '~utils/design-tokens';
25+
import { Divider } from '../../divider';
2526
import { Text } from '../../typography';
2627
import { UnstyledListItem } from './SidebarNavigationItemStyles';
2728

@@ -52,9 +53,11 @@ export const SidebarNavigationGroup = forwardRef<
5253
role="group"
5354
{...radixProps}>
5455
<SidebarNavigationGroupLabel id={id}>
55-
<Text isSubtle size="small">
56+
<SidebarNavigationGroupLabelText isSubtle size="small">
5657
{label}
57-
</Text>
58+
</SidebarNavigationGroupLabelText>
59+
60+
<SidebarNavigationGroupLabelDivider />
5861
</SidebarNavigationGroupLabel>
5962
<SidebarNavigationGroupList>{children}</SidebarNavigationGroupList>
6063
</SidebarNavigationGroupContainer>
@@ -87,12 +90,24 @@ const SidebarNavigationGroupLabel = styled.label`
8790
align-items: center;
8891
height: ${cssVar('dimension-height-800')};
8992
padding: 0 ${cssVar('dimension-space-100')};
93+
white-space: nowrap;
94+
`;
95+
SidebarNavigationGroupLabel.displayName = 'SidebarNavigationGroupLabel';
9096

97+
const SidebarNavigationGroupLabelText = styled(Text)`
9198
[data-sidebar-docked='false'] nav:not(:hover, :focus-within) & {
9299
display: none;
93100
}
94101
`;
95-
SidebarNavigationGroupLabel.displayName = 'SidebarNavigationGroupLabel';
102+
SidebarNavigationGroupLabelText.displayName = 'SidebarNavigationGroupLabelText';
103+
104+
const SidebarNavigationGroupLabelDivider = styled(Divider)`
105+
[data-sidebar-docked='true'] &,
106+
[data-sidebar-docked='false'] nav:is(:hover, :focus-within) & {
107+
display: none;
108+
}
109+
`;
110+
SidebarNavigationGroupLabelDivider.displayName = 'SidebarNavigationGroupLabelDivider';
96111

97112
export const SidebarNavigationGroupList = styled.ul`
98113
all: unset;

src/components/layout/sidebar-navigation/SidebarNavigationItem.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,14 @@ const NavigationItem = styled(NavLinkBase)`
139139
// This css property is set by the SidebarNavigationAccordionItem component
140140
// Fallback to flex if not inside an accordion
141141
display: var(--sidebar-navigation-accordion-children-display, flex);
142+
visibility: var(--sidebar-navigation-accordion-children-visibility, visible);
142143
143144
&:active,
144145
&.active {
145146
// Always display the item when active even if behind a closed accordion, this overrides the previously set display value from the css property
146147
display: flex;
148+
visibility: visible;
149+
outline: ${cssVar('color-support-white')} solid ${cssVar('focus-border-width-default')};
147150
148151
background-color: ${cssVar('sidebar-navigation-item-colors-background-active')};
149152
color: ${cssVar('color-text-accent')};

0 commit comments

Comments
 (0)