2023-08-08 11:55:51 +00:00
|
|
|
import {
|
|
|
|
FormControl,
|
|
|
|
FormLabel,
|
|
|
|
RadioGroup,
|
|
|
|
FormControlLabel,
|
|
|
|
Radio,
|
2023-08-08 13:21:05 +00:00
|
|
|
Typography,
|
2023-08-08 11:55:51 +00:00
|
|
|
} from "@mui/material";
|
|
|
|
import { Sex } from "../api/MemberApi";
|
|
|
|
|
|
|
|
export function SexSelection(p: {
|
2023-08-08 13:21:05 +00:00
|
|
|
readonly?: boolean;
|
2023-08-08 11:55:51 +00:00
|
|
|
current?: Sex;
|
|
|
|
onChange: (s: Sex) => void;
|
|
|
|
}): React.ReactElement {
|
2023-08-08 13:21:05 +00:00
|
|
|
if (p.readonly) {
|
|
|
|
if (p.current === undefined || p.current === null) return <></>;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Typography
|
|
|
|
variant="body2"
|
|
|
|
display="block"
|
|
|
|
style={{ marginBottom: "15px" }}
|
|
|
|
>
|
|
|
|
Sexe : {p.current === "M" ? "Homme" : "Femme"}
|
|
|
|
</Typography>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2023-08-08 11:55:51 +00:00
|
|
|
return (
|
|
|
|
<FormControl style={{ marginBottom: "15px" }}>
|
|
|
|
<FormLabel id="sex-label">Sexe</FormLabel>
|
|
|
|
<RadioGroup
|
|
|
|
row
|
|
|
|
aria-labelledby="sex-label"
|
|
|
|
value={p.current}
|
|
|
|
onChange={(e) => p.onChange(e.target.value as Sex)}
|
|
|
|
>
|
|
|
|
<FormControlLabel value="M" control={<Radio />} label="Homme" />
|
|
|
|
<FormControlLabel value="F" control={<Radio />} label="Femme" />
|
|
|
|
</RadioGroup>
|
|
|
|
</FormControl>
|
|
|
|
);
|
|
|
|
}
|