fix(dashboard-widget-netlify): migrate styled-components to vanilla-extract - #1842
fix(dashboard-widget-netlify): migrate styled-components to vanilla-extract#1842stipsan wants to merge 5 commits into
Conversation
…xtract Replace the ContentCard styled(Card) wrapper with a colocated .css.ts rule and thin component layer, enable the tsdown/vitest vanilla-extract integration, and drop the styled-components peer.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
🦋 Changeset detectedLatest commit: f77ed45 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 |
✅ E2E Tests🟢 26 passed • view full report • view run Studio: https://plugins-e2e-test-studio-3l2e3qfpu.sanity.dev Datasets: |
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||
Use the vanilla-extract && selector so min-height: 66px wins over @sanity/ui Card/Box defaults (styled-components previously won via CSSOM insertion order).
…lite Prefer clsx/lite over a template literal when merging the vanilla-extract class with a caller-provided className. Add clsx to the pnpm catalog.
There was a problem hiding this comment.
Pull request overview
Migrates sanity-plugin-dashboard-widget-netlify off styled-components to vanilla-extract, aligning the plugin with the monorepo’s zero-runtime CSS approach and adding the required build/test wiring for bundle.css.
Changes:
- Replaced the
styled(Card)wrapper with a vanilla-extract style (NetlifyWidget.css.ts) and a thinContentCardcomponent wrapper. - Updated build + test tooling to support vanilla-extract (
tsdown.config.ts,vitest.config.ts) and added./bundle.csspackage exports. - Added a patch changeset for the plugin release.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pnpm-lock.yaml | Updates lockfile for new vanilla-extract deps, but also bumps sanity: next resolutions repo-wide. |
| plugins/sanity-plugin-dashboard-widget-netlify/vitest.config.ts | Registers vanillaExtractPlugin() and disables runtime style injection in tests. |
| plugins/sanity-plugin-dashboard-widget-netlify/tsdown.config.ts | Switches tsdown from styledComponents to vanillaExtract output (bundle.css pipeline). |
| plugins/sanity-plugin-dashboard-widget-netlify/src/index.test.ts | Updates package-exports snapshot to include ./bundle.css. |
| plugins/sanity-plugin-dashboard-widget-netlify/src/components/NetlifyWidget.tsx | Replaces styled-components wrapper with a ContentCard component applying a vanilla-extract class. |
| plugins/sanity-plugin-dashboard-widget-netlify/src/components/NetlifyWidget.css.ts | Introduces contentCard style with && specificity and minHeight: 66. |
| plugins/sanity-plugin-dashboard-widget-netlify/package.json | Adds ./bundle.css export mapping and adds vanilla-extract-related devDependencies; removes styled-components peer. |
| .changeset/netlify-widget-vanilla-extract.md | Adds patch changeset describing the migration. |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…-vanilla-extract-d8ff
Keep the lockfile on sanity@6.9.1-next.6 (same as main) and only add the clsx catalog entry plus this widget's vanilla-extract deps.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 9 changed files in this pull request and generated no new comments.
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
Suppressed comments (2)
pnpm-lock.yaml:2120
- The lockfile update pulls in a newer
sanityprerelease (6.9.1-next.9) for this importer (and the diff shows the same bump across many importers). That expands the PR scope beyond the Netlify widget styling migration and adds review/upgrade risk.
If this wasn’t intentional, consider regenerating the lockfile in a way that only adds the new deps required for the migration (clsx / vanilla-extract tooling) while keeping the existing sanity@next resolution consistent with main, or split the dependency upgrade into a separate PR.
pnpm-workspace.yaml:53
clsxwas added to the shared pnpm catalog, but it appears to only be used bysanity-plugin-dashboard-widget-netlifyin this PR. Per the repo guidance, the catalog is meant for dependencies shared by 2+ packages; one-off deps are usually kept as an explicit version range in the consuming package to avoid growing the global catalog unnecessarily.
'@vis.gl/react-google-maps': ^1.9.0
'@vitest/coverage-v8': ^4.1.10
babel-plugin-react-compiler: ^1.0.0
clsx: ^2.1.1
date-fns: ^4.4.0
Summary
Migrates
sanity-plugin-dashboard-widget-netlifystyling fromstyled-componentsto vanilla-extract (zero-runtime CSS), following the monorepo migration skill.Changes
styled(Card)ContentCardwrapper with a colocatedNetlifyWidget.css.tsrule and a thinContentCardcomponent that preserves the same call-site APIclassNamewithclsx/lite(addedclsxto the pnpm catalog)&&specificity selector somin-height: 66pxwins over@sanity/uiCard/Box defaults (styled-components previously won via CSSOM insertion order)tsdown.config.tsfromstyledComponents: truetovanillaExtract: true(emitsdist/bundle.cssand wires the./bundle.cssexport)@sanity/vanilla-extract-vite-plugininvitest.config.ts(withdisableRuntimeStyles)styled-componentspeer dependency; kept thecatalog:devDependency for@sanity/uipeer-variant alignmentVerification
dist/bundle.cssemits.kd2ym90.kd2ym90{min-height:66px}dist/index.jsimportssanity-plugin-dashboard-widget-netlify/bundle.cssand usesclsxfromclsx/lite./bundle.cssmin-height: 66pxpnpm format/pnpm lint/pnpm knip/ CI-styleturbo build --filter='!./dev/*'/pnpm test run(211 files) all passNetlify widget rendered
Computed min-height 66px after && specificity fix
Test plan
To show artifacts inline, enable in settings.