2023-03-20 11:40:19 +00:00
|
|
|
import { List, ListItem, Typography } from "@mui/material";
|
|
|
|
import { useState } from "react";
|
|
|
|
|
|
|
|
type Props = {
|
2023-03-23 12:03:08 +00:00
|
|
|
setType: React.Dispatch<React.SetStateAction<string>>;
|
|
|
|
_mocsk_: { name: string; type: string }[];
|
2023-03-20 11:40:19 +00:00
|
|
|
};
|
|
|
|
|
2023-03-23 12:03:08 +00:00
|
|
|
export const CustomRadioButtons: React.FC<Props> = ({ setType, _mocsk_ }) => {
|
|
|
|
const [active, setActive] = useState<number>(0);
|
|
|
|
|
2023-03-23 15:34:26 +00:00
|
|
|
const onClick = (index: number, type: string) => {
|
2023-03-23 12:03:08 +00:00
|
|
|
setActive(index);
|
|
|
|
setType(type);
|
|
|
|
};
|
2023-03-20 11:40:19 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<List
|
|
|
|
sx={{
|
|
|
|
marginLeft: "-10px",
|
|
|
|
width: "430px",
|
|
|
|
display: "flex",
|
|
|
|
fontWeight: "500",
|
|
|
|
fontSize: " 16px",
|
|
|
|
whiteSpace: "nowrap",
|
|
|
|
}}
|
|
|
|
>
|
2023-03-23 12:03:08 +00:00
|
|
|
{_mocsk_.map(({ name, type }, index) =>
|
2023-03-20 11:40:19 +00:00
|
|
|
active === index ? (
|
2023-03-23 15:34:26 +00:00
|
|
|
<ListItem key={type} onClick={() => onClick(index, type)} sx={{ color: "#7E2AEA", cursor: "pointer" }}>
|
2023-03-20 11:40:19 +00:00
|
|
|
<Typography component="span" sx={{ borderBottom: "1px solid #7E2AEA", fontSize: " 16px" }}>
|
|
|
|
{name}
|
|
|
|
</Typography>
|
|
|
|
</ListItem>
|
|
|
|
) : (
|
2023-03-23 15:34:26 +00:00
|
|
|
<ListItem key={type} onClick={() => onClick(index, type)} sx={{ cursor: "pointer" }}>
|
2023-03-20 11:40:19 +00:00
|
|
|
{name}
|
|
|
|
</ListItem>
|
|
|
|
)
|
|
|
|
)}
|
|
|
|
</List>
|
|
|
|
);
|
|
|
|
};
|