mirror of
https://github.com/iib0011/omni-tools.git
synced 2025-12-29 16:16:02 +00:00
refactor: tool options components
This commit is contained in:
34
src/components/options/CheckboxWithDesc.tsx
Normal file
34
src/components/options/CheckboxWithDesc.tsx
Normal file
@@ -0,0 +1,34 @@
|
||||
import React from 'react';
|
||||
import { Box, Checkbox, FormControlLabel, Typography } from '@mui/material';
|
||||
|
||||
const CheckboxWithDesc = ({
|
||||
title,
|
||||
description,
|
||||
checked,
|
||||
onChange
|
||||
}: {
|
||||
title: string;
|
||||
description: string;
|
||||
checked: boolean;
|
||||
onChange: (value: boolean) => void;
|
||||
}) => {
|
||||
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||
onChange(event.target.checked);
|
||||
};
|
||||
|
||||
return (
|
||||
<Box>
|
||||
<FormControlLabel
|
||||
control={
|
||||
<Checkbox defaultChecked checked={checked} onChange={handleChange} />
|
||||
}
|
||||
label={title}
|
||||
/>
|
||||
<Typography fontSize={12} mt={1}>
|
||||
{description}
|
||||
</Typography>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
export default CheckboxWithDesc;
|
||||
Reference in New Issue
Block a user