Skip to content

refactor(sanity-translations-tab): migrate styled-components to vanilla-extract - #1843

Open
stipsan wants to merge 2 commits into
mainfrom
cursor/translations-tab-vanilla-extract-4eb9
Open

refactor(sanity-translations-tab): migrate styled-components to vanilla-extract#1843
stipsan wants to merge 2 commits into
mainfrom
cursor/translations-tab-vanilla-extract-4eb9

Conversation

@stipsan

@stipsan stipsan commented Aug 6, 2026

Copy link
Copy Markdown
Member

Summary

Migrates sanity-translations-tab styling from styled-components to vanilla-extract (zero-runtime CSS), following the monorepo migration skill.

Changes

  • Replaced the WrapText styled(Box) in NewTask with a colocated .css.ts + thin wrapper
  • Moved static/dynamic inline style={{}} usage in NewTask, ProgressBar, and LanguageStatus into vanilla-extract (createVar + assignInlineVars for progress scale)
  • Enabled vanillaExtract: true in tsdown.config.ts (emits dist/bundle.css)
  • Added @vanilla-extract/css / @sanity/vanilla-extract-vite-plugin (dev) and @vanilla-extract/dynamic (runtime)
  • Removed styled-components from peerDependencies (kept as catalog: devDependency for @sanity/ui peer alignment)
  • Registered vanillaExtractPlugin() in Vitest and updated the package-exports snapshot
  • Wired the same Vitest plugin into dependents sanity-plugin-studio-smartling and sanity-plugin-transifex (they import this package via workspace source)
  • Documented the dependent-Vitest follow-up in the migration skill and AGENTS.md
  • Patch changesets for sanity-translations-tab, sanity-plugin-studio-smartling, and sanity-plugin-transifex

Verification

  • pnpm format / pnpm lint / pnpm knip pass
  • pnpm turbo run build --filter='!./dev/*' (CI-equivalent) passes
  • pnpm test run — 211 files / 1281 tests pass
  • Manual visual check in test studio Translations tab: locale grid, text wrapping, interactive selection, no CSS console errors

Translations tab create job form
Translations tab with locales selected

To show artifacts inline, enable in settings.

Open in Web Open in Cursor 

…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.
@vercel

vercel Bot commented Aug 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
plugins-studio Ready Ready Preview Aug 6, 2026 7:47am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
plugins-e2e-test-studio Ignored Ignored Aug 6, 2026 7:47am

Request Review

@changeset-bot

changeset-bot Bot commented Aug 6, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d61b740

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

This PR includes changesets to release 3 packages
Name Type
sanity-plugin-studio-smartling Patch
sanity-plugin-transifex Patch
sanity-translations-tab 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

@stipsan stipsan added the 🤖 bot label Aug 6, 2026 — with Cursor
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

✅ E2E Tests

🟢 25 passed🟡 1 flakyview full reportview run

Studio: https://plugins-e2e-test-studio-j6dn844la.sanity.dev

Datasets: pr-1843-chromium-31082258527, pr-1843-firefox-31082258527

@socket-security

socket-security Bot commented Aug 6, 2026

Copy link
Copy Markdown

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.
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 32% 5507 / 17209
🔵 Statements 31.77% 5811 / 18288
🔵 Functions 27.77% 1427 / 5137
🔵 Branches 23.33% 2828 / 12120
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
plugins/sanity-translations-tab/src/components/LanguageStatus.css.ts 0% 0% 0% 0%
plugins/sanity-translations-tab/src/components/LanguageStatus.tsx 12.5% 0% 0% 12.5% 22-55
plugins/sanity-translations-tab/src/components/NewTask.css.ts 0% 0% 0% 0%
plugins/sanity-translations-tab/src/components/NewTask.tsx 4.25% 0% 0% 4.65% 22, 26-49, 56-196
plugins/sanity-translations-tab/src/components/ProgressBar.css.ts 0% 0% 0% 0%
plugins/sanity-translations-tab/src/components/ProgressBar.tsx 0% 0% 0% 0% 7-25
Generated in workflow #8756 for commit d61b740 by the Vitest Coverage Report Action

@stipsan
stipsan marked this pull request as ready for review August 6, 2026 08:53
@stipsan
stipsan requested a review from a team as a code owner August 6, 2026 08:53
@stipsan
stipsan requested review from a team, Copilot and pedrobonamin and removed request for a team August 6, 2026 08:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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-components usage and inline style={{...}} with colocated vanilla-extract .css.ts modules (including dynamic vars via assignInlineVars).
  • Enabled vanilla-extract output in tsdown (emitting dist/bundle.css) and exported ./bundle.css from 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.

Comment thread pnpm-lock.yaml
Comment on lines 259 to +261
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)
Comment on lines +21 to +23
function WrapText({className, ...props}: ComponentProps<typeof Box>) {
return <Box {...props} className={`${wrapText} ${className ?? ''}`} />
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants