Skip to content

Commit 51915ca

Browse files
committedJul 9, 2021
refactor(field): migrate slug diff to @sanity/ui
1 parent 6099f45 commit 51915ca

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed
 

‎packages/@sanity/field/src/types/slug/diff/SlugFieldDiff.css

-7
This file was deleted.

‎packages/@sanity/field/src/types/slug/diff/SlugFieldDiff.tsx

-3
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,13 @@ import React from 'react'
22
import {DiffComponent, DiffFromTo, ObjectDiff} from '../../../diff'
33
import {SlugPreview} from '../preview'
44

5-
import styles from './SlugFieldDiff.css'
6-
75
interface Slug {
86
current?: string
97
}
108

119
export const SlugFieldDiff: DiffComponent<ObjectDiff<Slug>> = ({diff, schemaType}) => {
1210
return (
1311
<DiffFromTo
14-
cardClassName={styles.card}
1512
layout="inline"
1613
diff={diff}
1714
schemaType={schemaType}
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,21 @@
1+
import {Box} from '@sanity/ui'
12
import React from 'react'
3+
import styled from 'styled-components'
4+
import {Slug} from '@sanity/types'
25
import {PreviewComponent} from '../../../preview/types'
3-
import {Slug} from '../types'
6+
7+
const SlugWrapper = styled.div`
8+
display: inline-block;
9+
word-break: break-all;
10+
white-space: pre-wrap;
11+
`
412

513
export const SlugPreview: PreviewComponent<Slug> = (props) => {
614
const {value} = props
715

8-
return <>{value.current}</>
16+
return (
17+
<Box as={SlugWrapper} paddingX={2} paddingY={1}>
18+
{value.current}
19+
</Box>
20+
)
921
}

0 commit comments

Comments
 (0)
Please sign in to comment.