Skip to content

PageLayout: Prevent content region from wrapping on wide viewports - #1846

Merged
colebemis merged 9 commits into
mainfrom
fix-content-width
Feb 9, 2022
Merged

PageLayout: Prevent content region from wrapping on wide viewports#1846
colebemis merged 9 commits into
mainfrom
fix-content-width

Conversation

@colebemis

@colebemiscolebemis commented Feb 8, 2022

Copy link
Copy Markdown
Contributor

Problem

If the contents of PageLayout.Content are too wide, PageLayout.Content wraps onto a different line than PageLayout.Pane.

Solution

This PR fixes this issue with a combination of flex-grow: 1 and flex-basis: 0% to ensure that PageLayout.Content never wraps on wide viewports.

Screenshots

BeforeAfter
CleanShot 2022-02-08 at 14 57 24CleanShot 2022-02-08 at 14 56 22

Browsers

  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari

Part of https://github.com/github/primer/issues/565

@changeset-bot

changeset-botBot commented Feb 8, 2022

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: bbdfc2d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
NameType
@primer/reactPatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actionsBot commented Feb 8, 2022

Copy link
Copy Markdown
Contributor

size-limit report 📦

PathSize
dist/browser.esm.js62.5 KB (0%)
dist/browser.umd.js62.88 KB (0%)

@colebemis
colebemis marked this pull request as ready for review February 8, 2022 23:05
@colebemis
colebemis requested review from a team and mperrottiFebruary 8, 2022 23:05
@colebemis

Copy link
Copy Markdown
ContributorAuthor

🚫 Looks like this broke the other stories. Investigating...

@colebemis

Copy link
Copy Markdown
ContributorAuthor

Fixed with flex-basis

Comment threadsrc/PageLayout/PageLayout.tsx Outdated
// 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.
flexBasis: '0%',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nitpick: we could just say flexBasis: 0. We don't need the unit

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch!

Comment threadsrc/PageLayout/PageLayout.tsx Outdated
@colebemis
colebemis enabled auto-merge (squash) February 9, 2022 16:38
@colebemis
colebemis merged commit 65c405b into mainFeb 9, 2022
@colebemis
colebemis deleted the fix-content-width branch February 9, 2022 16:55
@primer-cssprimer-css mentioned this pull request Feb 9, 2022
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@colebemis@mperrotti