From 96a0537e2bbead4ca7f7d3768af15ed6dc9ffaa7 Mon Sep 17 00:00:00 2001 From: Siddharth Kshetrapal Date: Fri, 4 Aug 2023 16:23:40 +0200 Subject: [PATCH 1/8] Revert 57c4bdf --- src/PageLayout/PageLayout.docs.json | 3 +- .../PageLayout.features.stories.tsx | 96 ++-- src/PageLayout/PageLayout.stories.tsx | 33 ++ src/PageLayout/PageLayout.test.tsx | 4 +- src/PageLayout/PageLayout.tsx | 30 +- .../__snapshots__/PageLayout.test.tsx.snap | 473 +++++++++--------- src/SplitPageLayout/SplitPageLayout.docs.json | 5 +- .../SplitPageLayout.stories.tsx | 32 ++ .../SplitPageLayout.test.tsx.snap | 21 +- 9 files changed, 383 insertions(+), 314 deletions(-) diff --git a/src/PageLayout/PageLayout.docs.json b/src/PageLayout/PageLayout.docs.json index 199f7f27edb..dfa273638c5 100644 --- a/src/PageLayout/PageLayout.docs.json +++ b/src/PageLayout/PageLayout.docs.json @@ -137,8 +137,7 @@ "name": "position", "type": "| 'start' | 'end' | { narrow?: | 'start' | 'end' regular?: | 'start' | 'end' wide?: | 'start' | 'end' }", "defaultValue": "'end'", - "description": "Use source order instead of relying on the `position` prop", - "deprecated": true + "description": "" }, { "name": "positionWhenNarrow", diff --git a/src/PageLayout/PageLayout.features.stories.tsx b/src/PageLayout/PageLayout.features.stories.tsx index 2713af247f4..9a168985c56 100644 --- a/src/PageLayout/PageLayout.features.stories.tsx +++ b/src/PageLayout/PageLayout.features.stories.tsx @@ -83,42 +83,49 @@ export const StickyPane: Story = args => ( - + - {Array.from({length: args.numParagraphsInPane}).map((_, i) => { - const testId = `paragraph${i}` + {Array.from({length: args.numParagraphsInContent}).map((_, i) => { + const testId = `content${i}` return ( Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam at enim id lorem tempus egestas a non ipsum. Maecenas imperdiet ante quam, at varius lorem molestie vel. Sed at eros consequat, varius tellus et, auctor felis. Donec pulvinar lacinia urna nec commodo. Phasellus at imperdiet risus. Donec sit amet - massa purus. + massa purus. Nunc sem lectus, bibendum a sapien nec, tristique tempus felis. Ut porttitor auctor tellus + in imperdiet. Ut blandit tincidunt augue, quis fringilla nunc tincidunt sed. Vestibulum auctor euismod + nisi. Nullam tincidunt est in mi tincidunt dictum. Sed consectetur aliquet velit ut ornare. ) })} - - + + - {Array.from({length: args.numParagraphsInContent}).map((_, i) => { - const testId = `content${i}` + {Array.from({length: args.numParagraphsInPane}).map((_, i) => { + const testId = `paragraph${i}` return ( Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam at enim id lorem tempus egestas a non ipsum. Maecenas imperdiet ante quam, at varius lorem molestie vel. Sed at eros consequat, varius tellus et, auctor felis. Donec pulvinar lacinia urna nec commodo. Phasellus at imperdiet risus. Donec sit amet - massa purus. Nunc sem lectus, bibendum a sapien nec, tristique tempus felis. Ut porttitor auctor tellus - in imperdiet. Ut blandit tincidunt augue, quis fringilla nunc tincidunt sed. Vestibulum auctor euismod - nisi. Nullam tincidunt est in mi tincidunt dictum. Sed consectetur aliquet velit ut ornare. + massa purus. ) })} - + @@ -151,32 +158,32 @@ export const NestedScrollContainer: Story = args => ( - + - {Array.from({length: args.numParagraphsInPane}).map((_, i) => ( + {Array.from({length: args.numParagraphsInContent}).map((_, i) => ( Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam at enim id lorem tempus egestas a non ipsum. Maecenas imperdiet ante quam, at varius lorem molestie vel. Sed at eros consequat, varius tellus et, auctor felis. Donec pulvinar lacinia urna nec commodo. Phasellus at imperdiet risus. Donec sit amet - massa purus. + massa purus. Nunc sem lectus, bibendum a sapien nec, tristique tempus felis. Ut porttitor auctor tellus + in imperdiet. Ut blandit tincidunt augue, quis fringilla nunc tincidunt sed. Vestibulum auctor euismod + nisi. Nullam tincidunt est in mi tincidunt dictum. Sed consectetur aliquet velit ut ornare. ))} - - + + - {Array.from({length: args.numParagraphsInContent}).map((_, i) => ( + {Array.from({length: args.numParagraphsInPane}).map((_, i) => ( Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam at enim id lorem tempus egestas a non ipsum. Maecenas imperdiet ante quam, at varius lorem molestie vel. Sed at eros consequat, varius tellus et, auctor felis. Donec pulvinar lacinia urna nec commodo. Phasellus at imperdiet risus. Donec sit amet - massa purus. Nunc sem lectus, bibendum a sapien nec, tristique tempus felis. Ut porttitor auctor tellus - in imperdiet. Ut blandit tincidunt augue, quis fringilla nunc tincidunt sed. Vestibulum auctor euismod - nisi. Nullam tincidunt est in mi tincidunt dictum. Sed consectetur aliquet velit ut ornare. + massa purus. ))} - + @@ -221,23 +228,6 @@ export const CustomStickyHeader: Story = args => ( Custom sticky header - - - {Array.from({length: args.numParagraphsInPane}).map((_, i) => { - const testId = `paragraph${i}` - return ( - - - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam at enim id lorem tempus egestas a non - ipsum. Maecenas imperdiet ante quam, at varius lorem molestie vel. Sed at eros consequat, varius - tellus et, auctor felis. Donec pulvinar lacinia urna nec commodo. Phasellus at imperdiet risus. Donec - sit amet massa purus. - - - ) - })} - - {Array.from({length: args.numParagraphsInContent}).map((_, i) => { @@ -258,6 +248,30 @@ export const CustomStickyHeader: Story = args => ( })} + + + {Array.from({length: args.numParagraphsInPane}).map((_, i) => { + const testId = `paragraph${i}` + return ( + + + Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam at enim id lorem tempus egestas a non + ipsum. Maecenas imperdiet ante quam, at varius lorem molestie vel. Sed at eros consequat, varius + tellus et, auctor felis. Donec pulvinar lacinia urna nec commodo. Phasellus at imperdiet risus. Donec + sit amet massa purus. + + + ) + })} + + @@ -292,7 +306,7 @@ export const ResizablePane: Story = () => ( - + @@ -309,7 +323,7 @@ export const ScrollContainerWithinPageLayoutPane: Story = () => ( - + diff --git a/src/PageLayout/PageLayout.stories.tsx b/src/PageLayout/PageLayout.stories.tsx index d3cc95afd72..2ec2aaa0f56 100644 --- a/src/PageLayout/PageLayout.stories.tsx +++ b/src/PageLayout/PageLayout.stories.tsx @@ -34,6 +34,9 @@ const meta: Meta = { 'Content.hidden.regular': false, 'Content.hidden.narrow': false, 'Content.hidden.wide': false, + 'Pane.position.regular': 'end', + 'Pane.position.narrow': 'end', + 'Pane.position.wide': 'end', 'Pane.width': 'medium', 'Pane.sticky': false, 'Pane.resizable': false, @@ -202,6 +205,31 @@ const meta: Meta = { table: {category: 'Content props'}, }, + // Pane prop controls + 'Pane.position.regular': { + type: { + name: 'enum', + value: ['start', 'end'], + }, + control: {type: 'radio'}, + table: {category: 'Pane props'}, + }, + 'Pane.position.narrow': { + type: { + name: 'enum', + value: ['start', 'end'], + }, + control: {type: 'radio'}, + table: {category: 'Pane props'}, + }, + 'Pane.position.wide': { + type: { + name: 'enum', + value: ['start', 'end'], + }, + control: {type: 'radio'}, + table: {category: 'Pane props'}, + }, 'Pane.width': { type: { name: 'enum', @@ -354,6 +382,11 @@ const Template: Story = args => ( {args['Render pane?'] ? ( { Header - + Content + Pane - Content Footer , diff --git a/src/PageLayout/PageLayout.tsx b/src/PageLayout/PageLayout.tsx index 76c7c9eb59d..effd9a9f929 100644 --- a/src/PageLayout/PageLayout.tsx +++ b/src/PageLayout/PageLayout.tsx @@ -107,23 +107,7 @@ const Root: React.FC> = ({ }} > {slots.header} - ({ - display: 'flex', - flex: '1 1 100%', - flexWrap: 'wrap', - maxWidth: '100%', - [`@media screen and (max-width: ${theme.breakpoints[2]})`]: { - rowGap: SPACING_MAP[rowGap], - }, - [`@media screen and (min-width: ${theme.breakpoints[1]})`]: { - columnGap: SPACING_MAP[columnGap], - }, - })} - > - {rest} - + {rest} {slots.footer} @@ -444,6 +428,7 @@ const Content: React.FC> = ({ { display: isHidden ? 'none' : 'flex', flexDirection: 'column', + order: REGION_ORDER.content, // Set flex-basis to 0% to allow flex-grow to control the width of the content region. // Without this, the content region could wrap onto a different line // than the pane region on wide viewports if its contents are too wide. @@ -564,7 +549,7 @@ const Pane = React.forwardRef -
+
Pane @@ -234,10 +232,10 @@ exports[`PageLayout renders condensed layout 1`] = `