-
Notifications
You must be signed in to change notification settings - Fork 535
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
PageHeader: Handle responsive CSS properties with breakpoints #2662
Conversation
🦋 Changeset detectedLatest commit: 0927bd1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
size-limit report 📦
|
a20914b
to
6629315
Compare
68def40
to
ca2deb6
Compare
4df374d
to
4987885
Compare
hidden
prop
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to go after you make the function name change 👍 Nice work on this @broccolinisoup 🎉
99d3e7a
to
0927bd1
Compare
hidden
prop* try using media query instead of hook * Update to use css media queries and make the func more generic * add comments and rename the function * update unit tests * add changeset * remove unused imports * address code review feedback * type fixes & small adj & add fallback CSS declaration * type fix and add comment * update tests * update changeset description * rename the function and move it into utils/
* try using media query instead of hook * Update to use css media queries and make the func more generic * add comments and rename the function * update unit tests * add changeset * remove unused imports * address code review feedback * type fixes & small adj & add fallback CSS declaration * type fix and add comment * update tests * update changeset description * rename the function and move it into utils/
Closes https://github.com/github/primer/issues/1569
Following up a #2265 (comment) for shifting the responsiveness logic from JS to CSS via using media queries to make the component more SSR friendly.
Context:
Currently PageHeader uses
useResponsiveHook
to manage components' visibility viahidden
prop. It works fine however, this causes a layout shift in SSR. To avoid that, this PR adds a utility function calledCSSManagedResponsiveValue
and it manages the responsive visibility with CSS breakpoints and still keeps the same APIor
Screenshots
No visual changes
Merge checklist
Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.