Skip to content

Commit 386fb57

Browse files
committed
refactor: add invalid tippy content type enum
1 parent abb81bb commit 386fb57

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
export { default as InvalidYAMLTippyWrapper } from './InvalidYAMLTippyWrapper'
22
export { getInvalidTippyContent } from './utils'
3+
export { InvalidTippyTypeEnum } from './types'

src/Shared/Components/InvalidYAMLTippy/types.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,12 @@ export interface InvalidYAMLTippyWrapperProps {
55
restoreLastSavedYAML?: () => void
66
children: TooltipProps['children']
77
}
8+
9+
export enum InvalidTippyTypeEnum {
10+
YAML = 'yaml',
11+
JSON = 'json',
12+
}
13+
14+
export interface InvalidTippyProps extends Pick<InvalidYAMLTippyWrapperProps, 'parsingError' | 'restoreLastSavedYAML'> {
15+
type?: InvalidTippyTypeEnum
16+
}

src/Shared/Components/InvalidYAMLTippy/utils.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { ReactComponent as ICArrowCounterClockwise } from '@Icons/ic-arrow-counter-clockwise.svg'
22
import { DEFAULT_INVALID_YAML_ERROR } from './constants'
3-
import { InvalidYAMLTippyWrapperProps } from './types'
3+
import { InvalidTippyProps, InvalidTippyTypeEnum } from './types'
44

55
export const getInvalidTippyContent = ({
6-
type = 'yaml',
6+
type = InvalidTippyTypeEnum.YAML,
77
parsingError,
88
restoreLastSavedYAML,
9-
}: Pick<InvalidYAMLTippyWrapperProps, 'parsingError' | 'restoreLastSavedYAML'> & { type?: 'yaml' | 'json' }) => {
9+
}: InvalidTippyProps) => {
1010
const text = type.toUpperCase()
1111

1212
return (

0 commit comments

Comments
 (0)