Skip to content

chore(Separator): migrate to CSS Modules with visual regression baseline#1046

Open
DreaminDani wants to merge 3 commits into
mainfrom
chore/migrate-separator-css-modules
Open

chore(Separator): migrate to CSS Modules with visual regression baseline#1046
DreaminDani wants to merge 3 commits into
mainfrom
chore/migrate-separator-css-modules

Conversation

@DreaminDani
Copy link
Copy Markdown
Contributor

@DreaminDani DreaminDani commented May 27, 2026

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.ts passes with zero snapshot regenerations
  • yarn test Separator, yarn lint:css, yarn lint:code, yarn build all green
  • grep -r 'styled-components' src/components/Separator/ empty

Closes 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 Separator styling from styled-components to CSS Modules while keeping the same Radix-based API and intended visuals. Styles move into Separator.module.css using --click-separator-* tokens, with cva / cn mapping orientation + size to margin variant classes; the component now accepts an optional className merged 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.ts for 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.

@DreaminDani DreaminDani self-assigned this May 27, 2026
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 27, 2026

🦋 Changeset detected

Latest commit: 5269b82

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

This PR includes changesets to release 1 package
Name Type
@clickhouse/click-ui Patch

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

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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-components styling with Separator.module.css + cva/cn class 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.

Comment thread src/components/Separator/Separator.stories.tsx
Comment thread tests/display/separator.spec.ts
- 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).
@workflow-authentication-public
Copy link
Copy Markdown
Contributor

Storybook Preview Deployed

✅ Preview URL: https://click-ovs7upflw-clickhouse.vercel.app

Built from commit: d02ac1dc3093813236766a2c027c326028c88a4b

DreaminDani added a commit that referenced this pull request May 27, 2026
Match the convention established in PRs #1045, #1046, #1048, and
#1050 and codified in the migration skill: tests/utils/ is reserved
for shared helpers like getStoryUrl, primitives go in tests/display/.

Visual regression remains byte-for-byte: 10/10 snapshots match without
regeneration.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants