chore(Accordion): migrate to CSS Modules with visual regression baseline#1074
Conversation
🦋 Changeset detectedLatest commit: 1aaba98 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
Migrates the Accordion component’s styling from styled-components to CSS Modules while adding Storybook + Playwright visual-regression coverage to ensure visual parity. It also adjusts the Vitest/Vite server filesystem settings to support running tests from nested git worktrees.
Changes:
- Add Storybook stories + Playwright visual-regression spec and baseline screenshots for
Accordionvariants and interactive states. - Replace
styled-componentsstyling withAccordion.module.cssandcva/cn, keeping DOM structure consistent. - Relax Vite/Vitest filesystem strictness to support nested worktree test runs, and add a patch changeset.
Reviewed changes
Copilot reviewed 6 out of 24 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| vite.config.ts | Relaxes Vite server FS strictness for Vitest runs in nested worktrees. |
| tests/display/accordion.spec.ts | Adds Playwright visual-regression coverage for Accordion variants + interactions. |
| src/components/Accordion/Accordion.tsx | Migrates Accordion styling to CSS Modules and introduces className support via cn. |
| src/components/Accordion/Accordion.stories.tsx | Adds a visual harness decorator and variant stories used by snapshots. |
| src/components/Accordion/Accordion.module.css | New CSS Module implementing former styled-components rules + sidebar overrides. |
| .changeset/migrate-accordion-to-css-modules.md | Records the migration as a patch release note. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…gration Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2bdf3de to
d6db74c
Compare
Storybook Preview Deployed✅ Preview URL: https://click-fvunb7v02-clickhouse.vercel.app Built from commit: |
Commits
test(Accordion): add visual regression baseline before CSS Modules migration— adds stories (size, color, with-icon, fill-width, open variants), a Playwright spec, and fresh PNG snapshots that capture the current styled-components rendering.chore(Accordion): migrate styling from styled-components to CSS Modules— replaces styled-components withAccordion.module.css+cva/cn. DOM-identical, byte-for-byte visual parity verified.SidebarAccordionis preserved as a thin wrapper that applies the sidebar modifier class.Verification
yarn test:visual tests/display/accordion.spec.tspasses with zero snapshot regenerations (20 tests)yarn test Accordion,yarn lint:css,yarn lint:code,yarn format,yarn buildall greengrep -r 'styled-components' src/components/Accordion/emptyNote
This branch is temporarily based on the unmerged vitest nested-worktree fix (
fix(test): let vitest resolve deps from nested git worktrees) so theyarn testgate can run in a nested worktree. That commit will drop out on rebase once the tooling fix lands onmain.Note
Low Risk
Styling-only refactor with explicit visual regression tests; public props stay the same aside from optional className and a simplified export surface.
Overview
Accordion styling moves from styled-components to
Accordion.module.css, withcva/cndriving size, color, andfillWidthon the trigger and root. Design tokens are wired through CSS variables so look-and-feel should match the previous theme-based rules.SidebarAccordionis now a thin wrapper that adds theaccordion_sidebarmodifier (chevron visibility and sidebar gap) instead of a nestedstyled(Accordion)block; the extraAccordionToExportstyled export is removed. The root accepts optionalclassName, andcolordefaults todefaultwhen omitted.Storybook gains a fixed-width harness, variant stories (sizes, link color, icon, fill width, open), and a new Playwright suite for light/dark snapshots, hover/focus, and keyboard/a11y checks. A patch changeset records the migration with no intended behavior change.
Reviewed by Cursor Bugbot for commit 1aaba98. Bugbot is set up for automated code reviews on this repo. Configure here.