diff --git a/.changeset/sidebar-padding.md b/.changeset/sidebar-padding.md new file mode 100644 index 00000000000..e7569a5ed15 --- /dev/null +++ b/.changeset/sidebar-padding.md @@ -0,0 +1,5 @@ +--- +"@primer/react": patch +--- + +Fix PageLayout.Sidebar ignoring its padding prop diff --git a/packages/react/src/PageLayout/PageLayout.module.css b/packages/react/src/PageLayout/PageLayout.module.css index 526fa6d8ee5..d2ca689e1f2 100644 --- a/packages/react/src/PageLayout/PageLayout.module.css +++ b/packages/react/src/PageLayout/PageLayout.module.css @@ -840,6 +840,8 @@ .Sidebar { width: var(--pane-width-size); height: 100%; + /* stylelint-disable-next-line primer/spacing */ + padding: var(--spacing); overflow: auto; &:where([data-resizable]) { diff --git a/packages/react/src/PageLayout/PageLayout.test.tsx b/packages/react/src/PageLayout/PageLayout.test.tsx index f5aeb392218..373052f85ad 100644 --- a/packages/react/src/PageLayout/PageLayout.test.tsx +++ b/packages/react/src/PageLayout/PageLayout.test.tsx @@ -342,6 +342,20 @@ describe('PageLayout', async () => { }) describe('PageLayout.Sidebar', () => { + it.each([ + {padding: 'condensed', expectedPadding: '16px'}, + {padding: 'normal', expectedPadding: '24px'}, + ] as const)('applies $padding padding when the layout has no padding', ({padding, expectedPadding}) => { + render( + + Sidebar + Content + , + ) + + expect(getComputedStyle(page.getByText('Sidebar').element()).padding).toBe(expectedPadding) + }) + it('SidebarWrapper should prevent shrinking', () => { const {container} = render( diff --git a/packages/react/src/SplitPageLayout/SplitPageLayout.features.stories.tsx b/packages/react/src/SplitPageLayout/SplitPageLayout.features.stories.tsx index acc60838f33..d2caf02c04e 100644 --- a/packages/react/src/SplitPageLayout/SplitPageLayout.features.stories.tsx +++ b/packages/react/src/SplitPageLayout/SplitPageLayout.features.stories.tsx @@ -42,7 +42,7 @@ export const SettingsPage: StoryFn = () => ( export const WithSidebarStart: StoryFn = () => ( - +

Sidebar

@@ -86,7 +86,7 @@ export const WithSidebarStart: StoryFn = () => ( export const WithSidebarEnd: StoryFn = () => ( - +

Inspector

@@ -121,7 +121,13 @@ export const WithSidebarEnd: StoryFn = () => ( export const WithResizableSidebar: StoryFn = () => ( - +

Resizable Sidebar

@@ -146,7 +152,13 @@ export const WithResizableSidebar: StoryFn = () => ( export const WithSidebarAndResizablePane: StoryFn = () => ( - +

Sidebar

Full-height resizable sidebar

@@ -178,7 +190,7 @@ export const WithSidebarAndResizablePane: StoryFn = () = export const WithStickySidebar: StoryFn = () => ( - +

Sticky Sidebar

This sidebar stays fixed in the viewport as you scroll the page content.

@@ -207,6 +219,7 @@ export const WithStickySidebar: StoryFn = () => ( export const SidebarFullscreenResponsiveVariant: StoryFn = () => (