Skip to content

chore(GenericLabel): migrate to CSS Modules with visual regression baseline#1048

Open
DreaminDani wants to merge 4 commits into
mainfrom
chore/migrate-generic-label-css-modules
Open

chore(GenericLabel): migrate to CSS Modules with visual regression baseline#1048
DreaminDani wants to merge 4 commits into
mainfrom
chore/migrate-generic-label-css-modules

Conversation

@DreaminDani
Copy link
Copy Markdown
Contributor

@DreaminDani DreaminDani commented May 27, 2026

Commits

  • test(GenericLabel): add visual regression baseline before CSS Modules migration — adds stories, Playwright spec, and fresh PNG snapshots that capture the current rendering.
  • chore(GenericLabel): 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/generic-label.spec.ts passes with zero snapshot regenerations
  • yarn lint:css, yarn lint:code, yarn build all green
  • grep -r 'styled-components' src/components/GenericLabel/ empty

Closes CUI-32


Note

Low Risk
Scoped styling migration on a single form label component with parity-focused CSS and new visual tests; no auth, data, or API contract changes beyond optional className merging.

Overview
GenericLabel is refactored from styled-components to CSS Modules (GenericLabel.module.css) with cva/cn for the disabled modifier and optional className, while keeping the same label semantics and design-token-driven default/hover/focus/disabled styling (disabled still suppresses interactive hover/focus styling).

Storybook gains Default and Disabled examples for stable visual checks, and a new Playwright suite (tests/display/generic-label.spec.ts) snapshots default, disabled, hover, and focus-within in light and dark themes. A changeset records a patch-level, no-behavior-change release note for @clickhouse/click-ui.

Reviewed by Cursor Bugbot for commit 15c70fc. 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: 15c70fc

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 adds visual-regression coverage for GenericLabel and then migrates its styling from styled-components to CSS Modules, preserving the component’s rendered output while enabling class-based variant styling via cva/cn.

Changes:

  • Added Storybook stories plus a Playwright visual regression suite (light + system-dark, including hover/focus-within) for GenericLabel.
  • Replaced styled-components label styling with GenericLabel.module.css and cva-based variants, with className merging support.
  • Added a patch changeset documenting the no-behavior-change migration.

Reviewed changes

Copilot reviewed 5 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/utils/generic-label.spec.ts Adds Playwright visual snapshots for default/disabled/hover/focus-within in light and system-dark themes.
src/components/GenericLabel/GenericLabel.tsx Swaps styled-component implementation for CSS Modules + cva variants and className merging.
src/components/GenericLabel/GenericLabel.stories.tsx Adds dedicated Default and Disabled stories used by the visual regression tests.
src/components/GenericLabel/GenericLabel.module.css Introduces CSS Module styles mirroring the prior styled-components states (default/hover/focus/disabled).
.changeset/migrate-generic-label-to-css-modules.md Records the styling migration as a patch changeset entry.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .changeset/migrate-generic-label-to-css-modules.md
Form Field generic label
<input
id="disabled-input"
defaultValue="value"
Address Copilot's standing review feedback on the migration PRs:
tests/utils/ is reserved for shared helpers like getStoryUrl;
component specs belong in component-family folders. Migration skill
updated in PR #1049 to codify this for future migrations.

Visual regression remains byte-for-byte: 8/8 snapshots match without
regeneration.
Address Copilot review feedback on PR #1048: the Disabled story
labelled itself "Disabled" but only the GenericLabel had the disabled
prop set; the nested input was still interactive. Pass `disabled` to
the input too so the story represents a fully-disabled field, matching
the story's name.

The two disabled-state snapshots are regenerated to reflect the
native disabled input rendering (greyed background, no caret). The
other six snapshots (default, hover, focus-within in both themes)
remain byte-for-byte unchanged.
@workflow-authentication-public
Copy link
Copy Markdown
Contributor

Storybook Preview Deployed

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

Built from commit: 335fcd2e3a5b3816a71ee1f1fb97b0069430bf37

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