chore(RadioGroup): migrate to CSS Modules with visual regression baseline#1086
Open
DreaminDani wants to merge 2 commits into
Open
chore(RadioGroup): migrate to CSS Modules with visual regression baseline#1086DreaminDani wants to merge 2 commits into
DreaminDani wants to merge 2 commits into
Conversation
…igration Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
Storybook Preview Deployed✅ Preview URL: https://click-6fsqbwzmd-clickhouse.vercel.app Built from commit: |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR migrates the RadioGroup component’s styling from styled-components to CSS Modules while adding Storybook stories and Playwright visual regression coverage to preserve rendering parity across themes and states.
Changes:
- Added Playwright visual regression spec for
RadioGroup(light/dark, states, hover/focus, basic a11y checks). - Replaced
styled-componentsstyles inRadioGroupwithRadioGroup.module.cssandcva/cn-driven class composition. - Added/expanded Storybook stories and included a patch changeset documenting the migration.
Reviewed changes
Copilot reviewed 5 out of 22 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/forms/radiogroup.spec.ts | Adds visual regression + interactive/a11y Playwright coverage for RadioGroup. |
| src/components/RadioGroup/RadioGroup.tsx | Migrates component styling to CSS Modules and forwards className. |
| src/components/RadioGroup/RadioGroup.stories.tsx | Adds dedicated stories to lock in baseline visuals for tests. |
| src/components/RadioGroup/RadioGroup.module.css | New CSS Module implementing former styled-components rules + specificity handling. |
| .changeset/migrate-radio-group-to-css-modules.md | Patch changeset describing the migration. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Commits
test(RadioGroup): add visual regression baseline before CSS Modules migration— adds stories, Playwright spec, and fresh PNG snapshots that capture the current rendering.chore(RadioGroup): migrate styling from styled-components to CSS Modules— replaces styled-components with.module.css+cva/cn. DOM-identical, byte-for-byte visual parity verified.Verification
yarn test:visual tests/forms/radiogroup.spec.tspasses with zero snapshot regenerations (21 tests)yarn test RadioGroup,yarn lint:css,yarn lint:code,yarn format,yarn buildall greengrep -r 'styled-components' src/components/RadioGroup/empty (only the originalFormRoot/GenericLabel/Label/Errorbuilding blocks from@/components/FormContainerstay as-is, matching the already-migrated Checkbox precedent)Note
Low Risk
Presentation-only refactor with visual regression coverage; public props and Radix behavior are intended to stay unchanged aside from styling specificity fixes for FormRoot.
Overview
RadioGroup styling moves off styled-components onto CSS Modules (
RadioGroup.module.css) withcva/cnfor inline/error layout variants, while Radix and existing FormRoot wiring stay the same. Items use module classes (including a.item.itemspecificity hook so layout overrides still win over FormRoot), andclassNameis forwarded on the group and items.Storybook gains dedicated stories (checked, disabled, inline/vertical, label/error, etc.) to lock appearance, and a new Playwright suite (
tests/forms/radiogroup.spec.ts) adds light/dark screenshots plus hover, focus, and basic a11y checks. A patch changeset records no intended behavior change.Reviewed by Cursor Bugbot for commit 50c76a0. Bugbot is set up for automated code reviews on this repo. Configure here.