Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove PageLayout.Pane position prop. #3386

Merged
merged 10 commits into from
Jun 20, 2023
5 changes: 5 additions & 0 deletions .changeset/yellow-windows-accept.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/react": major
---

Removes PageLayout.Pane position prop.
2 changes: 1 addition & 1 deletion generated/components.json
Original file line number Diff line number Diff line change
Expand Up @@ -3643,7 +3643,7 @@
"stories": [
{
"id": "components-splitpagelayout--default",
"code": "() => (\n <SplitPageLayout>\n <SplitPageLayout.Header>\n <Placeholder label=\"Header\" height={100} />\n </SplitPageLayout.Header>\n <SplitPageLayout.Pane position=\"start\">\n <Placeholder label=\"Pane\" height={400} />\n </SplitPageLayout.Pane>\n <SplitPageLayout.Content>\n <Placeholder label=\"Content\" height={600} />\n </SplitPageLayout.Content>\n <SplitPageLayout.Footer>\n <Placeholder label=\"Footer\" height={100} />\n </SplitPageLayout.Footer>\n </SplitPageLayout>\n)"
"code": "() => (\n <SplitPageLayout>\n <SplitPageLayout.Header>\n <Placeholder label=\"Header\" height={100} />\n </SplitPageLayout.Header>\n <SplitPageLayout.Pane>\n <Placeholder label=\"Pane\" height={400} />\n </SplitPageLayout.Pane>\n <SplitPageLayout.Content>\n <Placeholder label=\"Content\" height={600} />\n </SplitPageLayout.Content>\n <SplitPageLayout.Footer>\n <Placeholder label=\"Footer\" height={100} />\n </SplitPageLayout.Footer>\n </SplitPageLayout>\n)"
}
],
"props": [
Expand Down
10 changes: 5 additions & 5 deletions src/NavList/NavList.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const meta: Meta = {

export const Simple: Story = () => (
<PageLayout>
<PageLayout.Pane position="start">
<PageLayout.Pane>
<NavList>
<NavList.Item href="#" aria-current="page">
Item 1
Expand Down Expand Up @@ -45,7 +45,7 @@ export const WithGroup: Story = () => (

export const WithSubItems: Story = () => (
<PageLayout>
<PageLayout.Pane position="start">
<PageLayout.Pane>
<NavList>
<NavList.Item href="#">Item 1</NavList.Item>
<NavList.Item>
Expand All @@ -66,7 +66,7 @@ export const WithSubItems: Story = () => (

export const WithNestedSubItems: Story = () => (
<PageLayout>
<PageLayout.Pane position="start">
<PageLayout.Pane>
<NavList>
<NavList.Item href="#">Item 1</NavList.Item>
<NavList.Item href="#">
Expand Down Expand Up @@ -111,7 +111,7 @@ const ReactRouterLikeLink = React.forwardRef<HTMLAnchorElement, ReactRouterLikeL

export const WithReactRouterLink = () => (
<PageLayout>
<PageLayout.Pane position="start">
<PageLayout.Pane>
<NavList>
<NavList.Item as={ReactRouterLikeLink} to="#" aria-current="page">
Item 1
Expand Down Expand Up @@ -143,7 +143,7 @@ const NextJSLikeLink = React.forwardRef<HTMLAnchorElement, NextJSLinkProps>(

export const WithNextJSLink = () => (
<PageLayout>
<PageLayout.Pane position="start">
<PageLayout.Pane>
<NavList>
<NextJSLikeLink href="#">
<NavList.Item aria-current="page">Item 1</NavList.Item>
Expand Down
96 changes: 41 additions & 55 deletions src/PageLayout/PageLayout.features.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,49 +83,42 @@ export const StickyPane: Story = args => (
<PageLayout.Header padding="normal" divider="line">
<Placeholder label="Header" height={64} />
</PageLayout.Header>
<PageLayout.Content padding="normal" width="large">
<PageLayout.Pane resizable padding="normal" divider="line" sticky={args.sticky} aria-label="Side pane">
<Box sx={{display: 'grid', gap: 3}}>
{Array.from({length: args.numParagraphsInContent}).map((_, i) => {
const testId = `content${i}`
{Array.from({length: args.numParagraphsInPane}).map((_, i) => {
const testId = `paragraph${i}`
return (
<Box key={i} as="p" sx={{margin: 0}}>
<span data-testid={testId}>
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.
</span>
</Box>
)
})}
</Box>
</PageLayout.Content>
<PageLayout.Pane
position="start"
resizable
padding="normal"
divider="line"
sticky={args.sticky}
aria-label="Side pane"
>
</PageLayout.Pane>
<PageLayout.Content padding="normal" width="large">
<Box sx={{display: 'grid', gap: 3}}>
{Array.from({length: args.numParagraphsInPane}).map((_, i) => {
const testId = `paragraph${i}`
{Array.from({length: args.numParagraphsInContent}).map((_, i) => {
const testId = `content${i}`
return (
<Box key={i} as="p" sx={{margin: 0}}>
<span data-testid={testId}>
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.
</span>
</Box>
)
})}
</Box>
</PageLayout.Pane>
</PageLayout.Content>
<PageLayout.Footer padding="normal" divider="line">
<Placeholder label="Footer" height={64} />
</PageLayout.Footer>
Expand Down Expand Up @@ -158,32 +151,32 @@ export const NestedScrollContainer: Story = args => (
<PageLayout.Header padding="normal" divider="line">
<Placeholder label="Header" height={64} />
</PageLayout.Header>
<PageLayout.Content padding="normal" width="large">
<PageLayout.Pane padding="normal" divider="line" sticky aria-label="Side pane">
<Box sx={{display: 'grid', gap: 3}}>
{Array.from({length: args.numParagraphsInContent}).map((_, i) => (
{Array.from({length: args.numParagraphsInPane}).map((_, i) => (
<Box key={i} as="p" sx={{margin: 0}}>
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.
</Box>
))}
</Box>
</PageLayout.Content>
<PageLayout.Pane position="start" padding="normal" divider="line" sticky aria-label="Side pane">
</PageLayout.Pane>
<PageLayout.Content padding="normal" width="large">
<Box sx={{display: 'grid', gap: 3}}>
{Array.from({length: args.numParagraphsInPane}).map((_, i) => (
{Array.from({length: args.numParagraphsInContent}).map((_, i) => (
<Box key={i} as="p" sx={{margin: 0}}>
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.
</Box>
))}
</Box>
</PageLayout.Pane>
</PageLayout.Content>
<PageLayout.Footer padding="normal" divider="line">
<Placeholder label="Footer" height={64} />
</PageLayout.Footer>
Expand Down Expand Up @@ -228,6 +221,23 @@ export const CustomStickyHeader: Story = args => (
Custom sticky header
</Box>
<PageLayout rowGap="none" columnGap="none" padding="none" containerWidth="full">
<PageLayout.Pane padding="normal" divider="line" aria-label="Aside pane" sticky offsetHeader={args.offsetHeader}>
<Box sx={{display: 'grid', gap: 3}}>
{Array.from({length: args.numParagraphsInPane}).map((_, i) => {
const testId = `paragraph${i}`
return (
<Box key={i} as="p" sx={{margin: 0}}>
<span data-testid={testId}>
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.
</span>
</Box>
)
})}
</Box>
</PageLayout.Pane>
<PageLayout.Content padding="normal" width="large">
<Box sx={{display: 'grid', gap: 3}} data-testid="scrollContainer">
{Array.from({length: args.numParagraphsInContent}).map((_, i) => {
Expand All @@ -248,30 +258,6 @@ export const CustomStickyHeader: Story = args => (
})}
</Box>
</PageLayout.Content>
<PageLayout.Pane
position="start"
padding="normal"
divider="line"
aria-label="Aside pane"
sticky
offsetHeader={args.offsetHeader}
>
<Box sx={{display: 'grid', gap: 3}}>
{Array.from({length: args.numParagraphsInPane}).map((_, i) => {
const testId = `paragraph${i}`
return (
<Box key={i} as="p" sx={{margin: 0}}>
<span data-testid={testId}>
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.
</span>
</Box>
)
})}
</Box>
</PageLayout.Pane>
<PageLayout.Footer padding="normal" divider="line">
<Placeholder label="Footer" height={64} />
</PageLayout.Footer>
Expand Down Expand Up @@ -306,7 +292,7 @@ export const ResizablePane: Story = () => (
<PageLayout.Header>
<Placeholder height={64} label="Header" />
</PageLayout.Header>
<PageLayout.Pane resizable position="start">
<PageLayout.Pane resizable>
<Placeholder height={320} label="Pane" />
</PageLayout.Pane>
<PageLayout.Content>
Expand All @@ -323,7 +309,7 @@ export const ScrollContainerWithinPageLayoutPane: Story = () => (
<Box sx={{overflow: 'auto'}}>
<Placeholder label="Above inner scroll container" height={120} />
<PageLayout rowGap="none" columnGap="none" padding="none" containerWidth="full">
<PageLayout.Pane position="start" padding="normal" divider="line" sticky aria-label="Sticky pane">
<PageLayout.Pane padding="normal" divider="line" sticky aria-label="Sticky pane">
<Box sx={{overflow: 'auto'}}>
<PageLayout.Pane padding="normal">
<Placeholder label="Inner scroll container" height={800} />
Expand Down
34 changes: 0 additions & 34 deletions src/PageLayout/PageLayout.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ 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,
Expand Down Expand Up @@ -204,32 +201,6 @@ const meta: Meta = {
type: 'boolean',
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',
Expand Down Expand Up @@ -382,11 +353,6 @@ const Template: Story = args => (
</PageLayout.Content>
{args['Render pane?'] ? (
<PageLayout.Pane
position={{
narrow: args['Pane.position.narrow'],
regular: args['Pane.position.regular'],
wide: args['Pane.position.wide'],
}}
width={args['Pane.width']}
minWidth={args['Pane.minWidth']}
sticky={args['Pane.sticky']}
Expand Down
2 changes: 1 addition & 1 deletion src/PageLayout/PageLayout.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe('PageLayout', () => {
Header
</PageLayout.Header>
<PageLayout.Content>Content</PageLayout.Content>
<PageLayout.Pane position="start" divider="line" dividerWhenNarrow="filled">
<PageLayout.Pane divider="line" dividerWhenNarrow="filled">
Pane
</PageLayout.Pane>
<PageLayout.Footer dividerWhenNarrow="line">Footer</PageLayout.Footer>
Expand Down
Loading
Loading