Skip to content

Commit 723cce1

Browse files
committed
feat: remove styled-components
1 parent f01575f commit 723cce1

File tree

8 files changed

+59
-145
lines changed

8 files changed

+59
-145
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ An environment for designing, reviewing, and quality-testing React components.
77
npm install @sanity/ui-workshop -D
88

99
# Install peer dependencies
10-
npm install @sanity/icons @sanity/ui react react-dom
10+
npm install @sanity/ui react react-dom
1111
```
1212

1313
[![npm version](https://img.shields.io/npm/v/@sanity/ui-workshop.svg?style=flat-square)](https://www.npmjs.com/package/@sanity/ui-workshop)

package.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default defineConfig({
1414
},
1515
},
1616
tsconfig: 'tsconfig.dist.json',
17-
babel: {reactCompiler: true, styledComponents: true},
17+
babel: {reactCompiler: true},
1818
reactCompilerOptions: {target: '19'},
1919
rollup: {
2020
output: {

package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@
144144
"@typescript-eslint/eslint-plugin": "^7.18.0",
145145
"@typescript-eslint/parser": "^7.18.0",
146146
"babel-plugin-react-compiler": "19.1.0-rc.2",
147-
"babel-plugin-styled-components": "^2.1.4",
148147
"commitizen": "^4.3.1",
149148
"commitlint": "^19.8.1",
150149
"eslint": "^8.57.1",
@@ -164,16 +163,14 @@
164163
"react-dom": "^19.1.1",
165164
"react-is": "^19.1.1",
166165
"semantic-release": "^23.1.1",
167-
"styled-components": "^6.1.19",
168166
"tsconfig-paths": "^4.2.0",
169167
"typescript": "5.9.2",
170168
"vitest": "^3.2.4"
171169
},
172170
"peerDependencies": {
173171
"@sanity/ui": "^4.0.0-0",
174172
"react": "^19",
175-
"react-dom": "^19",
176-
"styled-components": "^6.1"
173+
"react-dom": "^19"
177174
},
178175
"packageManager": "pnpm@9.15.9",
179176
"publishConfig": {

pnpm-lock.yaml

Lines changed: 3 additions & 105 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/core/WorkshopCanvas.tsx

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,13 @@
11
import {Card, Container, Flex, Heading, Spinner, Stack, Text} from '@sanity/ui'
22
import type {Display} from '@sanity/ui/css'
33
import {memo, useMemo, useState} from 'react'
4-
import {styled} from 'styled-components'
4+
5+
import {iframe} from '#styles'
56

67
import {VIEWPORT_OPTIONS} from './constants'
78
import {buildFrameUrl} from './helpers'
89
import {useWorkshop} from './useWorkshop'
910

10-
const Frame = styled.iframe`
11-
display: block;
12-
border: 0;
13-
height: 100%;
14-
width: 100%;
15-
view-transition-name: canvas;
16-
`
17-
1811
/** @internal */
1912
export const WorkshopCanvas = memo(function WorkshopCanvas(props: {
2013
frameRef: React.Ref<HTMLIFrameElement>
@@ -43,7 +36,6 @@ export const WorkshopCanvas = memo(function WorkshopCanvas(props: {
4336
const frameStyle = useMemo(
4437
() => ({
4538
transform: `scale(${zoom})`,
46-
transformOrigin: '0 0',
4739
width: `${100 / zoom}%`,
4840
height: `${100 / zoom}%`,
4941
}),
@@ -73,7 +65,7 @@ export const WorkshopCanvas = memo(function WorkshopCanvas(props: {
7365
width="auto"
7466
>
7567
<Card height="fill" shadow={1}>
76-
<Frame ref={frameRef} src={initialFrameUrl} style={frameStyle} />
68+
<iframe className={iframe} ref={frameRef} src={initialFrameUrl} style={frameStyle} />
7769
</Card>
7870
</Container>
7971
</Flex>

src/core/inspector/WorkshopInspector.tsx

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,14 @@
22
import {Box, Card, Flex, TabPanel} from '@sanity/ui'
33
import type {Display, ResponsiveProp} from '@sanity/ui/css'
44
import {ElementType, memo, useState} from 'react'
5-
import {styled} from 'styled-components'
5+
6+
import {workshopInspector} from '#styles'
67

78
import {EMPTY_RECORD} from '../constants'
89
import {useWorkshop} from '../useWorkshop'
910
import {InspectorHeader} from './InspectorHeader'
1011
import {InspectorTab} from './types'
1112

12-
const Root = styled(Card)`
13-
@media screen and (min-width: 600px) {
14-
border-left: 1px solid var(--card-border-color);
15-
min-width: 180px;
16-
max-width: 300px;
17-
}
18-
`
19-
2013
const MemoRender = memo(function MemoRender(props: {component: ElementType; options: any}) {
2114
const {component: Component, options} = props
2215
return <Component options={options} />
@@ -47,7 +40,12 @@ export const WorkshopInspector = memo(function WorkshopInspector(props: {
4740
const display: ResponsiveProp<Display> = expanded ? ['block'] : ['none', 'none', 'block']
4841

4942
return (
50-
<Root display={display} flex={1} overflow={['hidden', 'hidden', 'auto']}>
43+
<Card
44+
className={workshopInspector}
45+
display={display}
46+
flex={1}
47+
overflow={['hidden', 'hidden', 'auto']}
48+
>
5149
<Flex direction="column" height="fill">
5250
{showTabs && <InspectorHeader currentTabId={tabId} onTabChange={setTabId} tabs={tabs} />}
5351

@@ -79,6 +77,6 @@ export const WorkshopInspector = memo(function WorkshopInspector(props: {
7977
</Box>
8078
)}
8179
</Flex>
82-
</Root>
80+
</Card>
8381
)
8482
})

0 commit comments

Comments
 (0)