chore(Separator): migrate to CSS Modules with visual regression baseline#1046
chore(Separator): migrate to CSS Modules with visual regression baseline#1046DreaminDani wants to merge 3 commits into
Conversation
🦋 Changeset detectedLatest commit: 5269b82 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
This PR migrates the Separator component’s styling from styled-components to CSS Modules while adding Storybook stories + Playwright visual snapshots to lock in rendering parity during/after the refactor.
Changes:
- Add Storybook “harness” stories for horizontal/vertical size variants and default orientation.
- Add a Playwright visual regression suite (light via Storybook global theme, dark via
prefers-color-scheme) with baseline snapshots. - Replace
styled-componentsstyling withSeparator.module.css+cva/cnclass mapping, and document as a patch changeset.
Reviewed changes
Copilot reviewed 5 out of 31 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
tests/utils/separator.spec.ts |
Adds Playwright visual regression coverage for Separator stories in light/dark themes. |
src/components/Separator/Separator.tsx |
Switches Separator implementation to CSS Modules + cva/cn class composition. |
src/components/Separator/Separator.stories.tsx |
Adds harness stories for snapshot-friendly rendering across variants. |
src/components/Separator/Separator.module.css |
Introduces CSS Module styles using Click UI CSS variables for stroke + spacing tokens. |
.changeset/migrate-separator-to-css-modules.md |
Records the migration as a patch release (no intended behavior change). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Move tests/utils/separator.spec.ts to tests/display/ (and matching snapshots). tests/utils/ is reserved for shared helpers like getStoryUrl; component specs belong in component-family folders. - Replace DefaultOrientation's HorizontalHarness render with a new DefaultHarness that omits the `orientation` prop entirely, so the story actually exercises the component's default-orientation behavior instead of explicitly setting `orientation="horizontal"`. Visual regression remains byte-for-byte: 26/26 snapshots match without regeneration (default-orientation rendering is identical to the explicit `horizontal` form since Radix's default is `horizontal`, which is exactly what the test is now correctly verifying).
Storybook Preview Deployed✅ Preview URL: https://click-ovs7upflw-clickhouse.vercel.app Built from commit: |
Commits
test(Separator): add visual regression baseline before CSS Modules migration— adds stories, Playwright spec, and fresh PNG snapshots that capture the current rendering.chore(Separator): 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/utils/separator.spec.tspasses with zero snapshot regenerationsyarn test Separator,yarn lint:css,yarn lint:code,yarn buildall greengrep -r 'styled-components' src/components/Separator/emptyCloses CUI-50
Note
Low Risk
Display-only styling refactor scoped to Separator, guarded by extensive visual snapshots and a patch changeset stating no behavior change.
Overview
Migrates
Separatorstyling from styled-components to CSS Modules while keeping the same Radix-based API and intended visuals. Styles move intoSeparator.module.cssusing--click-separator-*tokens, withcva/cnmappingorientation+sizeto margin variant classes; the component now accepts an optionalclassNamemerged onto the root.Adds Storybook harness stories (horizontal, vertical, and default orientation across all sizes) and a Playwright visual regression suite in
tests/display/separator.spec.tsfor light and dark themes. A patch changeset records no intended behavior change for@clickhouse/click-ui.Reviewed by Cursor Bugbot for commit 5269b82. Bugbot is set up for automated code reviews on this repo. Configure here.