Skip to content
Open
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
7 changes: 7 additions & 0 deletions .changeset/sidenav-collapsed-footer-centering.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@astryxdesign/core': patch
---

[fix] SideNav: center `footer` content in the collapsed rail. The collapsed variant of the sticky-bottom slot was missing the `alignItems: 'center'` that the children slot's collapsed variant already applies, so footer content stretched to the full rail width instead of centering.

@AKnassa
18 changes: 18 additions & 0 deletions packages/core/src/SideNav/SideNav.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,24 @@ describe('SideNav', () => {
expect(nav.children).toHaveLength(1);
});

it('centers footer content when collapsed, matching the children slot', () => {
render(
<SideNav
collapsible={{isCollapsed: true, hasButton: false}}
footer={<span data-testid="footer">Footer</span>}>
<span data-testid="content">Content</span>
</SideNav>,
);

// Control: the collapsed rail centers the children slot...
const scrollable = screen.getByTestId('content').parentElement!;
expect(getComputedStyle(scrollable).alignItems).toBe('center');

// ...and the footer slot must center the same way, not stretch.
const stickyBottom = screen.getByTestId('footer').parentElement!;
expect(getComputedStyle(stickyBottom).alignItems).toBe('center');
});

it('fires a consumer onClick on the collapse button in addition to toggling', async () => {
const user = userEvent.setup();
const onClick = vi.fn();
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/SideNav/SideNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ const styles = stylex.create({
},
stickyBottomCollapsed: {
paddingBlockStart: 0,
alignItems: 'center',
},
// Drawer footer — pushed to bottom of the scrollable content area
drawerFooter: {
Expand Down
Loading