|
1 |
| -import classNames from 'classnames' |
2 | 1 | import {isKeySegment, Path} from '@sanity/types'
|
3 | 2 | import React, {SyntheticEvent, useCallback} from 'react'
|
4 | 3 | import {ConnectorContext} from '@sanity/base/lib/change-indicators'
|
5 | 4 | import {startCase} from 'lodash'
|
6 | 5 | import {DiffCard, DiffContext, ObjectDiff, StringDiff, StringDiffSegment} from '../../../../diff'
|
7 |
| -import styles from './Text.css' |
| 6 | +import {InlineBox} from './styledComponents' |
8 | 7 |
|
9 | 8 | interface TextProps {
|
10 | 9 | diff?: StringDiff
|
@@ -32,21 +31,13 @@ export function Text({
|
32 | 31 | </TextWithDiff>
|
33 | 32 | )
|
34 | 33 | }
|
35 |
| - return <span className={styles.root}>{children}</span> |
| 34 | + return <InlineBox>{children}</InlineBox> |
36 | 35 | }
|
37 | 36 |
|
38 |
| -export function TextWithDiff({ |
39 |
| - diff, |
40 |
| - childDiff, |
41 |
| - children, |
42 |
| - path, |
43 |
| - segment, |
44 |
| - ...restProps |
45 |
| -}: TextProps & Omit<React.HTMLProps<HTMLSpanElement>, 'onClick'>) { |
| 37 | +export function TextWithDiff({diff, childDiff, children, path, segment, ...restProps}: TextProps) { |
46 | 38 | const {onSetFocus} = React.useContext(ConnectorContext)
|
47 | 39 | const {path: fullPath} = React.useContext(DiffContext)
|
48 | 40 | const spanSegment = path.slice(-2, 1)[0]
|
49 |
| - const className = classNames(styles.root, styles.changed) |
50 | 41 | const isRemoved = diff && diff.action === 'removed'
|
51 | 42 | const prefix = fullPath.slice(
|
52 | 43 | 0,
|
@@ -83,10 +74,10 @@ export function TextWithDiff({
|
83 | 74 | </DiffCard>
|
84 | 75 | ) : null
|
85 | 76 | return (
|
86 |
| - <span {...restProps} className={className} onClick={handleClick}> |
87 |
| - <span className={styles.previewContainer}> |
| 77 | + <InlineBox {...restProps} onClick={handleClick} data-changed=""> |
| 78 | + <span> |
88 | 79 | <>{diffCard || children}</>
|
89 | 80 | </span>
|
90 |
| - </span> |
| 81 | + </InlineBox> |
91 | 82 | )
|
92 | 83 | }
|
0 commit comments