diff --git a/.changeset/serious-sloths-hide.md b/.changeset/serious-sloths-hide.md new file mode 100644 index 00000000000..23e2541a8e1 --- /dev/null +++ b/.changeset/serious-sloths-hide.md @@ -0,0 +1,5 @@ +--- +'@primer/react': patch +--- + +Readjust order of `PageLayout.Pane` contents diff --git a/src/PageLayout/PageLayout.features.stories.tsx b/src/PageLayout/PageLayout.features.stories.tsx index 25c704eb2d8..66a4989bd8f 100644 --- a/src/PageLayout/PageLayout.features.stories.tsx +++ b/src/PageLayout/PageLayout.features.stories.tsx @@ -124,6 +124,9 @@ export const StickyPane: Story = args => ( ) })} + + Donec sit amet massa purus. Plura de lorem Ispum. + diff --git a/src/PageLayout/PageLayout.tsx b/src/PageLayout/PageLayout.tsx index a2321b06b40..378d8fe8c3d 100644 --- a/src/PageLayout/PageLayout.tsx +++ b/src/PageLayout/PageLayout.tsx @@ -758,8 +758,8 @@ const Pane = React.forwardRef - { - // 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))} - /> - {children} + + { + // 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))} + /> ) }, diff --git a/src/PageLayout/__snapshots__/PageLayout.test.tsx.snap b/src/PageLayout/__snapshots__/PageLayout.test.tsx.snap index ad552cc80d3..bb23bd6bec0 100644 --- a/src/PageLayout/__snapshots__/PageLayout.test.tsx.snap +++ b/src/PageLayout/__snapshots__/PageLayout.test.tsx.snap @@ -109,13 +109,6 @@ exports[`PageLayout renders condensed layout 1`] = ` } .c10 { - height: 100%; - position: relative; - display: none; - margin-right: 16px; -} - -.c11 { --pane-min-width: 256px; --pane-max-width-diff: 511px; --pane-max-width: calc(100vw - var(--pane-max-width-diff)); @@ -123,6 +116,13 @@ exports[`PageLayout renders condensed layout 1`] = ` padding: 0; } +.c11 { + height: 100%; + position: relative; + display: none; + margin-right: 16px; +} + .c12 { -webkit-order: 4; -ms-flex-order: 4; @@ -143,9 +143,9 @@ exports[`PageLayout renders condensed layout 1`] = ` width: auto; margin-top: 0 !important; margin-bottom: 0 !important; - -webkit-flex-direction: row; - -ms-flex-direction: row; - flex-direction: row; + -webkit-flex-direction: row-reverse; + -ms-flex-direction: row-reverse; + flex-direction: row-reverse; margin-left: 16px; } } @@ -162,20 +162,20 @@ exports[`PageLayout renders condensed layout 1`] = ` } @media screen and (min-width:768px) { - .c11 { + .c10 { width: 256px; overflow: auto; } } @media screen and (min-width:1012px) { - .c11 { + .c10 { width: 296px; } } @media screen and (min-width:1280px) { - .c11 { + .c10 { --pane-max-width-diff: 959px; } } @@ -226,13 +226,13 @@ exports[`PageLayout renders condensed layout 1`] = ` />
-
Pane
+