кастомная радиокнопка, не доработана
This commit is contained in:
parent
7fbc0f3b51
commit
03545f2a13
@ -2,6 +2,7 @@ import * as React from 'react';
|
|||||||
import NewFieldParent from "./NewFieldParent";
|
import NewFieldParent from "./NewFieldParent";
|
||||||
import {FormControlLabel, Switch} from "@mui/material";
|
import {FormControlLabel, Switch} from "@mui/material";
|
||||||
import SelectMask from "../SelectMask";
|
import SelectMask from "../SelectMask";
|
||||||
|
import CustomSwitch from "@ui_kit/CustomSwitch";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -29,7 +30,7 @@ export default function SwitchNewField({switchState ='name'}: Props) {
|
|||||||
<NewFieldParent placeholderHelp={'Введите номер'} placeholderField={'+7 900 000 00 00'} defaultValue={'phone'}>
|
<NewFieldParent placeholderHelp={'Введите номер'} placeholderField={'+7 900 000 00 00'} defaultValue={'phone'}>
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
value="start"
|
value="start"
|
||||||
control={<Switch color="primary" />}
|
control={<CustomSwitch/>}
|
||||||
label="Маска для телефона"
|
label="Маска для телефона"
|
||||||
labelPlacement="start"
|
labelPlacement="start"
|
||||||
sx={{
|
sx={{
|
||||||
|
|||||||
@ -16,6 +16,7 @@ import VidjetImg from "../../assets/VidjetImg.png"
|
|||||||
import SelectableButton from "../../components/CreateQuiz/SelectableButton";
|
import SelectableButton from "../../components/CreateQuiz/SelectableButton";
|
||||||
import LDownButton from "@icons/InstallQuizIcon/LDownButton";
|
import LDownButton from "@icons/InstallQuizIcon/LDownButton";
|
||||||
import RDownButton from "@icons/InstallQuizIcon/RDownButton";
|
import RDownButton from "@icons/InstallQuizIcon/RDownButton";
|
||||||
|
import CustomRadio from "@ui_kit/CustomRadio";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -103,13 +104,13 @@ export default function VidjetInstall () {
|
|||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
sx={{ color: theme.palette.grey2.main }}
|
sx={{ color: theme.palette.grey2.main }}
|
||||||
value="1"
|
value="1"
|
||||||
control={<Radio />}
|
control={<CustomRadio/>}
|
||||||
label="Да"
|
label="Да"
|
||||||
/>
|
/>
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
sx={{ color: theme.palette.grey2.main }}
|
sx={{ color: theme.palette.grey2.main }}
|
||||||
value="2"
|
value="2"
|
||||||
control={<Radio />}
|
control={<CustomRadio />}
|
||||||
label="Нет"
|
label="Нет"
|
||||||
/>
|
/>
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
|
|||||||
15
src/ui_kit/CustomRadio.tsx
Normal file
15
src/ui_kit/CustomRadio.tsx
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import {IconButton} from "@mui/material";
|
||||||
|
import {useState} from "react";
|
||||||
|
|
||||||
|
|
||||||
|
export default function CustomRadio () {
|
||||||
|
const [active, setActive] = useState<boolean>(false);
|
||||||
|
return (
|
||||||
|
<IconButton onClick={() => setActive(!active)}>
|
||||||
|
<svg width="26" height="26" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<rect x="0.5" y="0.5" width="25" height="25" rx="12.5" fill={active ? "#7E2AEA" : "#F2F3F7"} stroke={active ? "#7E2AEA" : "#9A9AAF"}/>
|
||||||
|
<rect x="8" y="8" width="10" height="10" rx="5" fill={active ? "white" : "#F2F3F7"}/>
|
||||||
|
</svg>
|
||||||
|
</IconButton>
|
||||||
|
)
|
||||||
|
}
|
||||||
@ -5,7 +5,7 @@ import {useState} from "react";
|
|||||||
export default function CustomSwitch () {
|
export default function CustomSwitch () {
|
||||||
const [active, setActive] = useState<boolean>(false);
|
const [active, setActive] = useState<boolean>(false);
|
||||||
return (
|
return (
|
||||||
<IconButton disableRipple onClick={() => setActive(!active)}>
|
<IconButton onClick={() => setActive(!active)}>
|
||||||
<svg width="52" height="30" viewBox="0 0 52 30" fill="none" xmlns="http://www.w3.org/2000/svg">
|
<svg width="52" height="30" viewBox="0 0 52 30" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
<rect width="52" height="30" rx="15" fill={active ? "#7E2AEA" : "#9A9AAF"} />
|
<rect width="52" height="30" rx="15" fill={active ? "#7E2AEA" : "#9A9AAF"} />
|
||||||
<rect
|
<rect
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user