Checkbox & Dropdown for Startup Variables (#3769)

This commit is contained in:
Boy132 2022-01-18 04:08:53 +01:00 committed by GitHub
parent e7884e4f0b
commit 7d0d71baec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 53 additions and 11 deletions

View file

@ -41,11 +41,12 @@ export interface SwitchProps {
label?: string;
description?: string;
defaultChecked?: boolean;
readOnly?: boolean;
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
children?: React.ReactNode;
}
const Switch = ({ name, label, description, defaultChecked, onChange, children }: SwitchProps) => {
const Switch = ({ name, label, description, defaultChecked, readOnly, onChange, children }: SwitchProps) => {
const uuid = useMemo(() => v4(), []);
return (
@ -58,6 +59,7 @@ const Switch = ({ name, label, description, defaultChecked, onChange, children }
type={'checkbox'}
onChange={e => onChange && onChange(e)}
defaultChecked={defaultChecked}
disabled={readOnly}
/>
}
<Label htmlFor={uuid}/>