refactor(sanity-translations-tab): migrate styled-components to vanilla-extract - #1843
refactor(sanity-translations-tab): migrate styled-components to vanilla-extract#1843stipsan wants to merge 2 commits into
Conversation
…la-extract Replace the WrapText styled Box and inline style objects with colocated .css.ts rules, enable the tsdown vanilla-extract integration, and drop the styled-components peer dependency.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
🦋 Changeset detectedLatest commit: d61b740 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
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🟢 25 passed • 🟡 1 flaky • view full report • view run Studio: https://plugins-e2e-test-studio-j6dn844la.sanity.dev Datasets: |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
sanity-plugin-studio-smartling and sanity-plugin-transifex import sanity-translations-tab via workspace source, so their package-exports tests need the Vite plugin after the .css.ts migration. Document this follow-up in the migration skill and AGENTS.md.
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Pull request overview
Migrates sanity-translations-tab from styled-components/inline styles to vanilla-extract (zero-runtime CSS), updating build/test plumbing and keeping workspace dependents’ Vitest setup compatible with .css.ts imports.
Changes:
- Replaced component-level
styled-componentsusage and inlinestyle={{...}}with colocated vanilla-extract.css.tsmodules (including dynamic vars viaassignInlineVars). - Enabled vanilla-extract output in
tsdown(emittingdist/bundle.css) and exported./bundle.cssfrom the package. - Registered
vanillaExtractPlugin()(and runtime style disabling) in Vitest for the migrated package and its workspace dependents; added changesets.
Reviewed changes
Copilot reviewed 19 out of 20 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-lock.yaml | Adds vanilla-extract-related deps; also updates the pinned sanity@next resolution in the lockfile. |
| plugins/sanity-translations-tab/vitest.config.ts | Registers vanilla-extract Vite plugin + disables runtime style injection in tests. |
| plugins/sanity-translations-tab/tsdown.config.ts | Switches build config from styled-components to vanillaExtract: true. |
| plugins/sanity-translations-tab/src/index.test.ts | Updates package-exports snapshot to include ./bundle.css. |
| plugins/sanity-translations-tab/src/components/ProgressBar.tsx | Moves transform styling to CSS var + assignInlineVars. |
| plugins/sanity-translations-tab/src/components/ProgressBar.css.ts | Adds vanilla-extract styles + createVar() contract for progress scaling. |
| plugins/sanity-translations-tab/src/components/NewTask.tsx | Replaces styled(Box) and inline styles with vanilla-extract classes + wrapper component. |
| plugins/sanity-translations-tab/src/components/NewTask.css.ts | Adds vanilla-extract styles for wrapping text and UI tweaks. |
| plugins/sanity-translations-tab/src/components/LanguageStatus.tsx | Moves inline width styling to a vanilla-extract class. |
| plugins/sanity-translations-tab/src/components/LanguageStatus.css.ts | Adds a specificity override style for full-width button. |
| plugins/sanity-translations-tab/package.json | Exports ./bundle.css and adds vanilla-extract dependencies for build/test/runtime. |
| plugins/sanity-plugin-transifex/vitest.config.ts | Registers vanilla-extract Vite plugin + disables runtime style injection in tests. |
| plugins/sanity-plugin-transifex/package.json | Adds @sanity/vanilla-extract-vite-plugin devDependency for Vitest. |
| plugins/sanity-plugin-studio-smartling/vitest.config.ts | Registers vanilla-extract Vite plugin + disables runtime style injection in tests. |
| plugins/sanity-plugin-studio-smartling/package.json | Adds @sanity/vanilla-extract-vite-plugin devDependency for Vitest. |
| AGENTS.md | Documents the “dependent workspace Vitest projects” follow-up requirement after migration. |
| .changeset/translations-tab-vanilla-extract.md | Patch changeset for sanity-translations-tab. |
| .changeset/transifex-vitest-vanilla-extract.md | Patch changeset for sanity-plugin-transifex. |
| .changeset/smartling-vitest-vanilla-extract.md | Patch changeset for sanity-plugin-studio-smartling. |
| .agents/skills/migrate-styled-components-to-vanilla-extract/SKILL.md | Updates migration guidance to include dependent Vitest projects steps. |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| sanity: | ||
| specifier: next | ||
| version: 6.9.1-next.6(@babel/core@7.29.7)(@babel/runtime@7.29.7)(@emotion/is-prop-valid@1.4.0)(@noble/hashes@2.2.0)(@rolldown/plugin-babel@0.2.3)(@sanity/sdk@2.19.0)(@types/node@24.13.3)(@types/react@19.2.18)(@vitejs/devtools@0.4.12)(babel-plugin-react-compiler@1.0.0)(esbuild@0.28.1)(jiti@2.7.0)(oxfmt@0.61.0)(react-dom@19.2.8)(react@19.2.8)(rolldown@1.2.1)(styled-components@6.4.4)(supports-color@8.1.1)(terser@5.49.0)(typescript@7.0.2) | ||
| version: 6.9.1-next.8(@babel/core@7.29.7)(@babel/runtime@7.29.7)(@emotion/is-prop-valid@1.4.0)(@noble/hashes@2.2.0)(@rolldown/plugin-babel@0.2.3)(@sanity/sdk@2.19.0)(@types/node@24.13.3)(@types/react@19.2.18)(@vitejs/devtools@0.4.12)(babel-plugin-react-compiler@1.0.0)(esbuild@0.28.1)(jiti@2.7.0)(oxfmt@0.61.0)(react-dom@19.2.8)(react@19.2.8)(rolldown@1.2.1)(styled-components@6.4.4)(supports-color@8.1.1)(terser@5.49.0)(typescript@7.0.2) |
| function WrapText({className, ...props}: ComponentProps<typeof Box>) { | ||
| return <Box {...props} className={`${wrapText} ${className ?? ''}`} /> | ||
| } |
Summary
Migrates
sanity-translations-tabstyling fromstyled-componentsto vanilla-extract (zero-runtime CSS), following the monorepo migration skill.Changes
WrapTextstyled(Box)inNewTaskwith a colocated.css.ts+ thin wrapperstyle={{}}usage inNewTask,ProgressBar, andLanguageStatusinto vanilla-extract (createVar+assignInlineVarsfor progress scale)vanillaExtract: trueintsdown.config.ts(emitsdist/bundle.css)@vanilla-extract/css/@sanity/vanilla-extract-vite-plugin(dev) and@vanilla-extract/dynamic(runtime)styled-componentsfrompeerDependencies(kept ascatalog:devDependencyfor@sanity/uipeer alignment)vanillaExtractPlugin()in Vitest and updated the package-exports snapshotsanity-plugin-studio-smartlingandsanity-plugin-transifex(they import this package via workspace source)AGENTS.mdsanity-translations-tab,sanity-plugin-studio-smartling, andsanity-plugin-transifexVerification
pnpm format/pnpm lint/pnpm knippasspnpm turbo run build --filter='!./dev/*'(CI-equivalent) passespnpm test run— 211 files / 1281 tests passTranslations tab create job form
Translations tab with locales selected
To show artifacts inline, enable in settings.