Can create VM from UI
This commit is contained in:
25
virtweb_frontend/src/widgets/forms/CheckboxInput.tsx
Normal file
25
virtweb_frontend/src/widgets/forms/CheckboxInput.tsx
Normal file
@ -0,0 +1,25 @@
|
||||
import { Checkbox, FormControlLabel, Typography } from "@mui/material";
|
||||
|
||||
export function CheckboxInput(p: {
|
||||
editable: boolean;
|
||||
label: string;
|
||||
checked: boolean | undefined;
|
||||
onValueChange: (v: boolean) => void;
|
||||
}): React.ReactElement {
|
||||
if (!p.editable && p.checked)
|
||||
return <Typography variant="body2">{p.label}</Typography>;
|
||||
|
||||
if (!p.editable) return <></>;
|
||||
|
||||
return (
|
||||
<FormControlLabel
|
||||
control={
|
||||
<Checkbox
|
||||
checked={p.checked}
|
||||
onChange={(e) => p.onValueChange(e.target.checked)}
|
||||
/>
|
||||
}
|
||||
label={p.label}
|
||||
/>
|
||||
);
|
||||
}
|
Reference in New Issue
Block a user