-
Notifications
You must be signed in to change notification settings - Fork 538
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
feat(Header): Convert Header to CSS modules behind team feature flag #5192
Conversation
🦋 Changeset detectedLatest commit: f2f1fcc 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 |
👋 Hi, this pull request contains changes to the source code that github/github depends on. If you are GitHub staff, we recommend testing these changes with github/github using the integration workflow. Thanks! |
size-limit report 📦
|
🟢 golden-jobs completed with status |
…rimer/react into hussam-i-am/css_modules_header
…am/css_modules_header
Updated the unit and storybook tests to verify |
packages/react/src/Header/Header.tsx
Outdated
className={clsx(className, enabled && classes.HeaderItem, enabled && rest.full && classes.Full)} | ||
{...rest} |
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.
For variant type props, we're using data-attributes for styling instead of classnames. You can read a little bit about that in the CSS authoring guide.
So for the full
prop, instead of a classname it would look something like this:
className={clsx(className, enabled && classes.HeaderItem, enabled && rest.full && classes.Full)} | |
{...rest} | |
className={clsx(className, enabled && classes.HeaderItem} | |
data-full={full} | |
{...rest} |
And then in CSS
&:where([data-full]) {
....
}
If you check out the ButtonBase component you can see this in action 😄
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.
Nice, makes a lot of sense, updated!
👋 Hi from github/github! Your integration PR is ready: https://github.com/github/github/pull/349206 |
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.
Sorry I was late on this! Just had a couple comments for this that I think would be good to cover
const isReactRouter = typeof to === 'string' | ||
if (isReactRouter) { | ||
// according to their docs, NavLink supports aria-current: | ||
// https://reacttraining.com/react-router/web/api/NavLink/aria-current-string | ||
return {'aria-current': 'page'} | ||
} else { | ||
return {} | ||
} |
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.
I think this logic will need to be ported over into the HeaderLink
so that it works with the flag enabled/disabled. Right now, it will only be applied when the styled component is used if I understand right 👀
data-full={rest.full} | ||
{...rest} |
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.
Closes https://github.com/github/primer/issues/4138
Changelog
New
Changed
Convert Header to CSS modules behind team feature flag
Removed
Rollout strategy
Testing & Reviewing
Merge checklist