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
5 changes: 5 additions & 0 deletions .changeset/quiet-sidebar-padding.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': patch
---

Fix `PageLayout.Sidebar` so its `padding` prop applies independently of the root layout padding.
2 changes: 2 additions & 0 deletions packages/react/src/PageLayout/PageLayout.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -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]) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import {describe, it, expect} from 'vitest'
import {render} from '@testing-library/react'
import {PageLayout} from './PageLayout'

describe('PageLayout.Sidebar padding', () => {
it('applies sidebar padding when the root has no padding', () => {
const {container} = render(
<PageLayout padding="none">
<PageLayout.Content>Content</PageLayout.Content>
<PageLayout.Sidebar padding="condensed">Sidebar</PageLayout.Sidebar>
</PageLayout>,
)

const sidebar = container.querySelector<HTMLElement>('[data-component="PageLayout.Sidebar"]')
expect(sidebar).not.toBeNull()
expect(getComputedStyle(sidebar!).paddingTop).toBe('16px')
})
})
Loading