Skip to content

Commit c414b18

Browse files
committedJul 12, 2021
refactor(field): migrate ptdiff header to @sanity/ui
1 parent 2c6f33a commit c414b18

File tree

2 files changed

+25
-39
lines changed

2 files changed

+25
-39
lines changed
 

‎packages/@sanity/field/src/types/portableText/diff/components/Header.css

-37
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
1+
import {Heading} from '@sanity/ui'
12
import React from 'react'
2-
import styles from './Header.css'
3+
import styled from 'styled-components'
4+
5+
const headingSizes = {
6+
h1: 2,
7+
h2: 1,
8+
h3: 0,
9+
h4: 0,
10+
h5: 0,
11+
h6: 0,
12+
}
13+
14+
const StyledHeading = styled(Heading)`
15+
&:not([hidden]) {
16+
display: inline;
17+
text-transform: none;
18+
margin: 0;
19+
20+
&::before,
21+
&::after {
22+
content: unset;
23+
}
24+
}
25+
`
326

427
export default function Header({
528
style,
@@ -8,5 +31,5 @@ export default function Header({
831
style: string
932
children: React.ReactNode
1033
}): JSX.Element {
11-
return <div className={styles[style]}>{children}</div>
34+
return <StyledHeading size={headingSizes[style]}>{children}</StyledHeading>
1235
}

0 commit comments

Comments
 (0)
Please sign in to comment.