@@ -3,27 +3,32 @@ import { DEFAULT_INVALID_YAML_ERROR } from './constants'
3
3
import { InvalidYAMLTippyWrapperProps } from './types'
4
4
5
5
export const getInvalidTippyContent = ( {
6
+ type = 'yaml' ,
6
7
parsingError,
7
8
restoreLastSavedYAML,
8
- } : Pick < InvalidYAMLTippyWrapperProps , 'parsingError' | 'restoreLastSavedYAML' > ) => (
9
- < div className = "flexbox-col dc__gap-8 py-6" >
10
- < div className = "flexbox-col dc__gap-4" >
11
- < h6 className = "m-0 fs-12 fw-6 lh-18" > Invalid YAML</ h6 >
12
- < p className = "m-0 cn-50 fs-12 fw-4 lh-18 dc__truncate--clamp-3" >
13
- { parsingError || DEFAULT_INVALID_YAML_ERROR }
14
- </ p >
15
- </ div >
9
+ } : Pick < InvalidYAMLTippyWrapperProps , 'parsingError' | 'restoreLastSavedYAML' > & { type ?: 'yaml' | 'json' } ) => {
10
+ const text = type . toUpperCase ( )
11
+
12
+ return (
13
+ < div className = "flexbox-col dc__gap-8 py-6" >
14
+ < div className = "flexbox-col dc__gap-4" >
15
+ < h6 className = "m-0 fs-12 fw-6 lh-18" > Invalid { text } </ h6 >
16
+ < p className = "m-0 cn-50 fs-12 fw-4 lh-18 dc__truncate--clamp-3" >
17
+ { parsingError || DEFAULT_INVALID_YAML_ERROR }
18
+ </ p >
19
+ </ div >
16
20
17
- { restoreLastSavedYAML && (
18
- < button
19
- type = "button"
20
- data-testid = "restore-last-saved-yaml"
21
- className = "flexbox dc__gap-6 dc__transparent cn-0 fs-12 fw-6 lh-20 p-0 dc__align-items-center"
22
- onClick = { restoreLastSavedYAML }
23
- >
24
- < ICArrowCounterClockwise className = "dc__no-shrink icon-dim-16 scn-0" />
25
- Restore last saved YAML
26
- </ button >
27
- ) }
28
- </ div >
29
- )
21
+ { restoreLastSavedYAML && (
22
+ < button
23
+ type = "button"
24
+ data-testid = "restore-last-saved-yaml"
25
+ className = "flexbox dc__gap-6 dc__transparent cn-0 fs-12 fw-6 lh-20 p-0 dc__align-items-center"
26
+ onClick = { restoreLastSavedYAML }
27
+ >
28
+ < ICArrowCounterClockwise className = "dc__no-shrink icon-dim-16 scn-0" />
29
+ Restore last saved { text }
30
+ </ button >
31
+ ) }
32
+ </ div >
33
+ )
34
+ }
0 commit comments