Skip to content
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
5 changes: 5 additions & 0 deletions .changeset/serious-sloths-hide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': patch
---

Readjust order of `PageLayout.Pane` contents
3 changes: 3 additions & 0 deletions src/PageLayout/PageLayout.features.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ export const StickyPane: Story = args => (
</Box>
)
})}
<Box as="p">
Donec sit amet massa purus. <a href="#foo">Plura de lorem Ispum.</a>
</Box>
</Box>
</PageLayout.Pane>
<PageLayout.Footer padding="normal" divider="line">
Expand Down
62 changes: 31 additions & 31 deletions src/PageLayout/PageLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -758,8 +758,8 @@ const Pane = React.forwardRef<HTMLDivElement, React.PropsWithChildren<PageLayout
}
: {}),
...(position === 'end'
? {flexDirection: 'row', marginLeft: SPACING_MAP[columnGap]}
: {flexDirection: 'row-reverse', marginRight: SPACING_MAP[columnGap]}),
? {flexDirection: 'row-reverse', marginLeft: SPACING_MAP[columnGap]}
: {flexDirection: 'row', marginRight: SPACING_MAP[columnGap]}),
},
},
sx,
Expand All @@ -771,35 +771,6 @@ const Pane = React.forwardRef<HTMLDivElement, React.PropsWithChildren<PageLayout
variant={{narrow: dividerVariant, regular: 'none'}}
sx={{[position === 'end' ? 'marginBottom' : 'marginTop']: SPACING_MAP[rowGap]}}
/>
<VerticalDivider
variant={{
narrow: 'none',
// If pane is resizable, always show a vertical divider on regular viewports
regular: resizable ? 'line' : dividerVariant,
}}
// If pane is resizable, the divider should be draggable
draggable={resizable}
sx={{[position === 'end' ? 'marginRight' : 'marginLeft']: SPACING_MAP[columnGap]}}
onDrag={(delta, isKeyboard = false) => {
// Get the number of pixels the divider was dragged
let deltaWithDirection
if (isKeyboard) {
deltaWithDirection = delta
} else {
deltaWithDirection = position === 'end' ? -delta : delta
}
updatePaneWidth(paneWidth + deltaWithDirection)
}}
// Ensure `paneWidth` state and actual pane width are in sync when the drag ends
onDragEnd={() => {
const paneRect = paneRef.current?.getBoundingClientRect()
if (!paneRect) return
updatePaneWidth(paneRect.width)
}}
// Reset pane width on double click
onDoubleClick={() => updatePaneWidth(getDefaultPaneWidth(width))}
/>

<Box
ref={paneRef}
style={{
Expand Down Expand Up @@ -828,6 +799,35 @@ const Pane = React.forwardRef<HTMLDivElement, React.PropsWithChildren<PageLayout
>
{children}
</Box>

<VerticalDivider
variant={{
narrow: 'none',
// If pane is resizable, always show a vertical divider on regular viewports
regular: resizable ? 'line' : dividerVariant,
}}
// If pane is resizable, the divider should be draggable
draggable={resizable}
sx={{[position === 'end' ? 'marginRight' : 'marginLeft']: SPACING_MAP[columnGap]}}
onDrag={(delta, isKeyboard = false) => {
// Get the number of pixels the divider was dragged
let deltaWithDirection
if (isKeyboard) {
deltaWithDirection = delta
} else {
deltaWithDirection = position === 'end' ? -delta : delta
}
updatePaneWidth(paneWidth + deltaWithDirection)
}}
// Ensure `paneWidth` state and actual pane width are in sync when the drag ends
onDragEnd={() => {
const paneRect = paneRef.current?.getBoundingClientRect()
if (!paneRect) return
updatePaneWidth(paneRect.width)
}}
// Reset pane width on double click
onDoubleClick={() => updatePaneWidth(getDefaultPaneWidth(width))}
/>
</Box>
)
},
Expand Down
Loading