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

Fix overflow issues in PageLayout.Content #2075

Merged
merged 9 commits into from
May 23, 2022
Merged
Show file tree
Hide file tree
Changes from 7 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
9 changes: 9 additions & 0 deletions .changeset/gentle-countries-rest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@primer/react": patch
---

Fix overflow issues in `PageLayout.Content`

| Before | After |
|--------|--------|
| <img width="1224" alt="image" src="https://user-images.githubusercontent.com/3026298/167502059-81e0ef9e-2fd6-40fe-b1f1-708368286578.png"> | <img width="1247" alt="image" src="https://user-images.githubusercontent.com/3026298/167502084-1c4f247e-2713-4419-8f4c-bb1a20e24dca.png"> |
15 changes: 15 additions & 0 deletions src/PageLayout/PageLayout.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,21 @@ export const PullRequestPage = () => (
</PageLayout.Header>
<PageLayout.Content>
<Box sx={{border: '1px solid', borderRadius: 2, borderColor: 'border.default', height: 200}}></Box>
<Box
sx={{
maxWidth: '100%',
overflowX: 'auto',
border: '1px solid',
whiteSpace: 'nowrap',
borderColor: 'border.default',
mt: 3,
p: 3,
borderRadius: 2
}}
>
This box has really long content. If it is too long, it will cause x overflow and should show a scrollbar. When
this overflows, it should not break to overall page layout!
</Box>
</PageLayout.Content>
<PageLayout.Pane>
<Box sx={{display: 'flex', flexDirection: 'column', gap: 3}}>
Expand Down
5 changes: 3 additions & 2 deletions src/PageLayout/PageLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import {Box} from '..'
import {BetterSystemStyleObject, merge, SxProp} from '../sx'
import {Box} from '..'

const REGION_ORDER = {
header: 0,
Expand Down Expand Up @@ -238,7 +238,8 @@ const Content: React.FC<PageLayoutContentProps> = ({width = 'full', children, sx
// than the pane region on wide viewports if its contents are too wide.
flexBasis: 0,
flexGrow: 1,
flexShrink: 1
flexShrink: 1,
minWidth: 1
colebemis marked this conversation as resolved.
Show resolved Hide resolved
},
sx
)}
Expand Down