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

refactor(Blankslate): add support for css modules to Blankslate #4810

Merged
merged 16 commits into from
Aug 7, 2024

Conversation

joshblack
Copy link
Member

@joshblack joshblack commented Aug 1, 2024

Context https://github.com/github/primer/issues/3696

Refactor Blankslate to use CSS Modules behind a feature flag

Changelog

New

Changed

  • Update Blankslate component to use CSS Modules
  • Add feature flag to Blankslate component to toggle between styled-components and CSS Modules
  • Use feature flag for VRT in Blankslate
  • Add fallback VRT tests for Blankslate
  • Update script for generating export sizes to use noop plugin for CSS in entrypoints

Removed

Rollout strategy

  • Minor release

Testing & Reviewing

  • Verify that no regressions have occurred in VRT
  • Verify that snapshots have been added for styled-component styles

Copy link

changeset-bot bot commented Aug 1, 2024

🦋 Changeset detected

Latest commit: 2416b6a

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

This PR includes changesets to release 1 package
Name Type
@primer/react Minor

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-actions bot added the staff Author is a staff member label Aug 1, 2024
Copy link
Contributor

github-actions bot commented Aug 1, 2024

size-limit report 📦

Path Size
packages/react/dist/browser.esm.js 95.8 KB (0%)
packages/react/dist/browser.umd.js 96.19 KB (0%)

@github-actions github-actions bot temporarily deployed to storybook-preview-4810 August 1, 2024 21:24 Inactive
…com:primer/react into refactor/update-blankslate-to-css-modules-2
@joshblack joshblack marked this pull request as ready for review August 1, 2024 21:49
@joshblack joshblack requested review from a team as code owners August 1, 2024 21:49
@github-actions github-actions bot temporarily deployed to storybook-preview-4810 August 1, 2024 21:53 Inactive
@joshblack
Copy link
Member Author

FYI @siddharthkp here was one idea for feature flagging in the classes 👀

return (
<span
className={cx('Blankslate-Visual', {
[classes.Visual]: enabled,
Copy link
Member

Choose a reason for hiding this comment

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

Note for feature flags only: This is cool! It's a little bit cheating because the component already had classNames 😅

</div>
</div>
)
}
Copy link
Member

Choose a reason for hiding this comment

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

Note for feature flags only: Idk how to feel about 2 completely different blocks. On one hand, it's very clear that one uses classNames without the Styled(component)Blankslate. On the other hand, if StyledBlankslate accepted sx, we wouldn't be able to do this and would need to merge them in some way.

I think this code looks good and we should ship it + we'll need to migrate a couple other components to see what our practices should be

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed, this one really feels like a one off because of how simple it is. In reality I think we'll have more mix-and-match and toggling inline

@joshblack joshblack added this pull request to the merge queue Aug 7, 2024
Merged via the queue into main with commit c0425ff Aug 7, 2024
30 checks passed
@joshblack joshblack deleted the refactor/update-blankslate-to-css-modules-2 branch August 7, 2024 16:10
@primer primer bot mentioned this pull request Aug 7, 2024

.Heading {
font-size: var(--text-title-size-medium, 1.25rem);
font-weight: var(--text-title-weight-medium, 600);
Copy link
Member

Choose a reason for hiding this comment

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

We don't need to add fallbacks for the values here, the PostCSS parser inlines them for us.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
staff Author is a staff member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants