2024-06-23 15:14:14 +01:00
|
|
|
import React from 'react';
|
|
|
|
|
import { Box, Checkbox, FormControlLabel, Typography } from '@mui/material';
|
|
|
|
|
|
|
|
|
|
const CheckboxWithDesc = ({
|
|
|
|
|
title,
|
|
|
|
|
description,
|
|
|
|
|
checked,
|
2024-06-24 20:09:16 -07:00
|
|
|
onChange,
|
|
|
|
|
disabled
|
2024-06-23 15:14:14 +01:00
|
|
|
}: {
|
|
|
|
|
title: string;
|
2025-03-09 17:45:13 +00:00
|
|
|
description?: string;
|
2024-06-23 15:14:14 +01:00
|
|
|
checked: boolean;
|
|
|
|
|
onChange: (value: boolean) => void;
|
2024-06-24 20:09:16 -07:00
|
|
|
disabled?: boolean;
|
2024-06-23 15:14:14 +01:00
|
|
|
}) => {
|
|
|
|
|
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
|
|
|
onChange(event.target.checked);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Box>
|
|
|
|
|
<FormControlLabel
|
|
|
|
|
control={
|
2024-06-24 20:09:16 -07:00
|
|
|
<Checkbox
|
|
|
|
|
checked={checked}
|
|
|
|
|
onChange={handleChange}
|
|
|
|
|
disabled={disabled}
|
|
|
|
|
/>
|
2024-06-23 15:14:14 +01:00
|
|
|
}
|
|
|
|
|
label={title}
|
|
|
|
|
/>
|
2025-03-09 17:45:13 +00:00
|
|
|
{description && (
|
|
|
|
|
<Typography fontSize={12} mt={1}>
|
|
|
|
|
{description}
|
|
|
|
|
</Typography>
|
|
|
|
|
)}
|
2024-06-23 15:14:14 +01:00
|
|
|
</Box>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default CheckboxWithDesc;
|