feat: add CSS Layer support to Avatar#7950
Conversation
🦋 Changeset detectedLatest commit: 11a730c 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 |
|
There was a problem hiding this comment.
Pull request overview
Adds initial automated coverage for CSS layer migrations and migrates Avatar’s CSS Module into a named Primer component layer to improve style override behavior and ensure consistent layering as more components migrate.
Changes:
- Added a new
css-layers.test.tsand wired it into Vitest so CSS layer migrations can be validated in CI. - Wrapped
Avatar.module.cssrules in@layer primer.components.Avatar. - Added
css-tree(+ typings) as a dev dependency to parse CSS for the new test.
Show a summary per file
| File | Description |
|---|---|
packages/react/vitest.config.mts |
Includes the new CSS layers test in the node Vitest run. |
packages/react/vitest.config.browser.mts |
Excludes the CSS layers test from browser-mode Vitest runs. |
packages/react/src/Avatar/Avatar.module.css |
Wraps Avatar styles in a named @layer for cascade layer migration. |
packages/react/src/__tests__/css-layers.test.ts |
New test to enforce presence/naming of CSS layers for allowlisted CSS Modules. |
packages/react/package.json |
Adds css-tree and @types/css-tree for parsing CSS in tests. |
package-lock.json |
Lockfile updates for the new dependencies. |
.changeset/avatar-css-layer.md |
Patch changeset describing the Avatar override behavior improvement. |
Copilot's findings
- Files reviewed: 6/7 changed files
- Comments generated: 3
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
e9de772 to
11a730c
Compare
|
Integration test results from github/github-ui PR:
VRT check ensures that when visual differences are detected, the PR cannot proceed until someone acknowledges the changes by adding the "visual difference acknowledged" label. Need help? If you believe this failure is unrelated to your changes, please reach out to the Primer team for assistance. |
Part of https://github.com/github/primer/issues/6275
Adds the initial CSS layer migration test setup and migrates Avatar styles into a named Primer component layer.
Changelog
New
Changed
@layer primer.components.Avatar.Removed
Rollout strategy
Testing & Reviewing
cd packages/react && npx vitest run src/__tests__/css-layers.test.ts --config vitest.config.mts.Merge checklist