File tree 2 files changed +28
-32
lines changed
packages/@sanity/field/src/types/portableText/diff/components
2 files changed +28
-32
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ import { Theme } from '@sanity/ui'
1
2
import React from 'react'
2
- import styles from './Decorator.css'
3
+ import styled from 'styled-components'
4
+
5
+ const DecoratorWrapper = styled . span `
6
+ display: inline;
7
+ ${ ( { theme, decoration} : { theme : Theme ; decoration : string } ) => {
8
+ switch ( decoration ) {
9
+ case 'strong' :
10
+ return 'font-weight: bold;'
11
+ case 'em' :
12
+ return 'font-style: italic;'
13
+ case 'underline' :
14
+ return 'text-decoration: underline;'
15
+ case 'overline' :
16
+ return 'text-decoration: overline;'
17
+ case 'strike-through' :
18
+ return 'text-decoration: line-through;'
19
+ case 'code' :
20
+ return `
21
+ font-family: ${ theme . sanity . fonts . code . family } ;
22
+ background: ${ theme . sanity . color . muted . default . enabled . bg } ;
23
+ `
24
+ default :
25
+ return ''
26
+ }
27
+ } }
28
+ `
3
29
4
30
export default function Decorator ( { mark, children} : { mark : string ; children : JSX . Element } ) {
5
- return < span className = { ` ${ styles [ mark ] } ` } > { children } </ span >
31
+ return < DecoratorWrapper decoration = { mark } > { children } </ DecoratorWrapper >
6
32
}
You can’t perform that action at this time.
0 commit comments