Skip to content

Commit ed3c1ca

Browse files
committed
feat: give type to getInvalidTippyContent
1 parent 83295b5 commit ed3c1ca

File tree

3 files changed

+29
-24
lines changed

3 files changed

+29
-24
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "1.2.5-beta-6",
3+
"version": "1.2.5-beta-7",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Shared/Components/InvalidYAMLTippy/utils.tsx

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,32 @@ import { DEFAULT_INVALID_YAML_ERROR } from './constants'
33
import { InvalidYAMLTippyWrapperProps } from './types'
44

55
export const getInvalidTippyContent = ({
6+
type = 'yaml',
67
parsingError,
78
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>
1620

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

Comments
 (0)