Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(frontend)[Age 1137]: Update design for JSON/YAML switch different #2169

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import CopyButton from "@/components/CopyButton/CopyButton"
import {getStringOrJson} from "@/lib/helpers/utils"
import {JSSTheme} from "@/lib/Types"
import {Collapse, Segmented, Space} from "antd"
import {Collapse, Radio, Space} from "antd"
import React, {useState, useMemo} from "react"
import {createUseStyles} from "react-jss"
import yaml from "js-yaml"
Expand Down Expand Up @@ -64,16 +64,6 @@ const useStyles = createUseStyles((theme: JSSTheme) => ({
backgroundColor: theme.colorBgContainerDisabled,
},
}),
segmentedBtn: {
border: `1px solid ${theme.colorBorder}`,
padding: 0,
"& .ant-segmented-item": {
padding: 2,
},
"& .ant-segmented-item-selected": {
outline: `1px solid ${theme.colorPrimary}`,
},
},
}))

const AccordionTreePanel = ({
Expand Down Expand Up @@ -138,15 +128,13 @@ const AccordionTreePanel = ({
extra: (
<Space size={12}>
{enableFormatSwitcher && typeof value !== "string" && (
<Segmented
options={["JSON", "YAML"]}
<Radio.Group
value={segmentedValue}
onChange={(optValue) => {
setSegmentedValue(optValue)
}}
onClick={(e) => e.stopPropagation()}
className={classes.segmentedBtn}
/>
onChange={(e) => setSegmentedValue(e.target.value)}
>
<Radio.Button value="JSON">JSON</Radio.Button>
<Radio.Button value="YAML">YAML</Radio.Button>
</Radio.Group>
)}
<CopyButton
text={
Expand Down