feat(web/input): support default values (#66)

* feat(web/dialog): Support placeholders

* feat(web/dialog): Support default values

* feat(web/dialog): Support default state of checkbox

* feat(web/dialog): Support placeholder for number input

* feat(web/dialog): Support default value for select
This commit is contained in:
ANTOND
2022-08-05 15:10:37 +02:00
committed by GitHub
parent 14a04c4b68
commit 1990e3792f
6 changed files with 38 additions and 5 deletions

View File

@@ -1,4 +1,5 @@
import { Box, Checkbox } from "@chakra-ui/react";
import { useEffect } from "react";
import { Row } from "../../../interfaces/dialog";
interface Props {
@@ -8,11 +9,16 @@ interface Props {
}
const CheckboxField: React.FC<Props> = (props) => {
useEffect(() => {
if(props.row.checked) props.handleChange(props.row.checked, props.index);
}, []);
return (
<>
<Box mb={3} key={`checkbox-${props.index}`}>
<Checkbox
onChange={(e) => props.handleChange(e.target.checked, props.index)}
defaultChecked={props.row.checked}
>
{props.row.label}
</Checkbox>