chore(Spacer): migrate to CSS Modules with visual regression baseline#1045
Open
DreaminDani wants to merge 3 commits into
Open
chore(Spacer): migrate to CSS Modules with visual regression baseline#1045DreaminDani wants to merge 3 commits into
DreaminDani wants to merge 3 commits into
Conversation
🦋 Changeset detectedLatest commit: b3e2657 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 |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR migrates the Spacer display component from styled-components to CSS Modules while adding visual regression coverage to ensure byte-for-byte rendering parity.
Changes:
- Added Storybook stories + a harness for consistent Spacer visual snapshots across all size variants.
- Introduced a Playwright visual regression suite with baseline snapshots for light and dark rendering.
- Replaced
styled-componentsstyling withSpacer.module.cssusingcva/cnclass variants, plus a changeset for the patch release.
Reviewed changes
Copilot reviewed 5 out of 19 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/utils/spacer.spec.ts | Adds Playwright visual regression tests for Spacer sizes in light/dark themes. |
| src/components/Spacer/Spacer.tsx | Switches Spacer implementation to CSS Modules + cva size variants. |
| src/components/Spacer/Spacer.stories.tsx | Adds SpacerHarness and per-size stories used by visual regression tests. |
| src/components/Spacer/Spacer.module.css | Introduces CSS Module classes mapping size variants to theme token CSS variables. |
| .changeset/migrate-spacer-to-css-modules.md | Records a patch changeset for the Spacer refactor. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Move tests/utils/spacer.spec.ts to tests/display/ (and matching snapshots).
tests/utils/ is reserved for shared helpers like getStoryUrl; component
specs belong in component-family folders, matching tests/buttons/ and
tests/cards/.
- Drop redundant `padding` from `.spacer` base class. The size variant is
always applied via cva's `defaultVariants: { size: 'md' }`, so the
duplicate value would have drifted over time.
Visual regression remains byte-for-byte: 14/14 snapshots match without
regeneration.
Contributor
Storybook Preview Deployed✅ Preview URL: https://click-1kqvfynr3-clickhouse.vercel.app Built from commit: |
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(Spacer): add visual regression baseline before CSS Modules migration— adds stories, Playwright spec, and fresh PNG snapshots that capture the current rendering.chore(Spacer): 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/spacer.spec.tspasses with zero snapshot regenerationsyarn test Spacer,yarn lint:css,yarn lint:code,yarn buildall greengrep -r 'styled-components' src/components/Spacer/emptyCloses CUI-55
Note
Low Risk
Styling-only refactor of a layout helper with explicit visual regression coverage; no API or security-sensitive logic changes.
Overview
Spacer moves off styled-components onto CSS Modules with the same design tokens (
--click-spacer-*),cva/cn, and default size md—intended as a no-behavior visual parity swap.Storybook gains a
SpacerHarnessand per-size stories for regression testing. A new Playwright suite snapshots each size in light and dark themes. A changeset records a patch release for@clickhouse/click-ui.Reviewed by Cursor Bugbot for commit b3e2657. Bugbot is set up for automated code reviews on this repo. Configure here.