Skip to content

Commit 48336c9

Browse files
authored
Merge pull request #1850 from AletheiaFact/migrate-order-radio
Migrate Order Radio
2 parents f28218c + 79f4911 commit 48336c9

File tree

1 file changed

+35
-45
lines changed

1 file changed

+35
-45
lines changed

src/components/Radio/OrderRadio.tsx

Lines changed: 35 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from "react";
2-
import { Radio, Space } from "antd";
2+
import { Radio, RadioGroup, FormControlLabel, Stack } from "@mui/material"
33
import styled from "styled-components";
44
import colors from "../../styles/colors";
55
import { useTranslation } from "next-i18next";
@@ -10,36 +10,31 @@ import { currentNameSpace } from "../../atoms/namespace";
1010
const RadioInput = styled(Radio)`
1111
margin: 10px 0 0 0;
1212
13-
.ant-radio-checked .ant-radio-inner {
14-
border: 2px solid
15-
${({ namespace }) =>
16-
namespace === NameSpaceEnum.Main
17-
? colors.primary
18-
: colors.secondary};
13+
&.Mui-checked {
14+
border: 2px solid
15+
color: ${({ namespace }) =>
16+
namespace === NameSpaceEnum.Main ? colors.primary : colors.secondary};
17+
}
18+
19+
&.MuiRadio-root {
20+
color: ${({ namespace }) =>
21+
namespace === NameSpaceEnum.Main ? colors.primary : colors.secondary};
1922
width: 25px;
2023
height: 25px;
2124
}
2225
23-
.ant-radio-checked .ant-radio-inner:after {
26+
&.Mui-checked::after {
2427
background-color: ${({ namespace }) =>
25-
namespace === NameSpaceEnum.Main
26-
? colors.primary
27-
: colors.secondary};
28+
namespace === NameSpaceEnum.Main ? colors.primary : colors.secondary};
2829
position: relative;
2930
top: 3px;
3031
left: 3px;
3132
width: 31px;
3233
height: 31px;
3334
}
3435
35-
span .ant-radio-inner {
36+
&.MuiRadio-root::before {
3637
box-shadow: 0px 0px 6px ${colors.shadow};
37-
width: 25px;
38-
height: 25px;
39-
}
40-
41-
.ant-radio-wrapper-checked > span:nth-child(2) {
42-
font-weight: 700;
4338
}
4439
`;
4540
//TODO: order by checked input label isn't bold
@@ -58,36 +53,31 @@ const OrderRadio = ({ value, setValue }: OrderRadioProps) => {
5853
};
5954

6055
return (
61-
<RadioInput.Group
62-
namespace={nameSpace}
56+
<RadioGroup
6357
onChange={onChangeRadio}
6458
value={value}
6559
>
66-
<Space style={{ marginTop: 10 }} direction="vertical">
67-
<RadioInput value="asc">
68-
<span
69-
style={{
70-
fontSize: 18,
71-
marginLeft: 10,
72-
color: colors.blackSecondary,
73-
}}
74-
>
75-
{t("orderModal:radioAsc")}
76-
</span>
77-
</RadioInput>
78-
<RadioInput value="desc">
79-
<span
80-
style={{
81-
fontSize: 18,
82-
marginLeft: 10,
83-
color: colors.blackSecondary,
84-
}}
85-
>
86-
{t("orderModal:radioDesc")}
87-
</span>
88-
</RadioInput>
89-
</Space>
90-
</RadioInput.Group>
60+
<Stack sx={{ marginTop: "30px" }} spacing={2}>
61+
<FormControlLabel
62+
value="asc"
63+
control={<RadioInput namespace={nameSpace} />}
64+
label={
65+
<span style={{ fontSize: 18, color: colors.blackSecondary, padding: "0 10px" }}>
66+
{t("orderModal:radioAsc")}
67+
</span>
68+
}
69+
/>
70+
<FormControlLabel
71+
value="desc"
72+
control={<RadioInput namespace={nameSpace} />}
73+
label={
74+
<span style={{ fontSize: 18, color: colors.blackSecondary, padding: "0 10px" }}>
75+
{t("orderModal:radioDesc")}
76+
</span>
77+
}
78+
/>
79+
</Stack>
80+
</RadioGroup>
9181
);
9282
};
9383

0 commit comments

Comments
 (0)