diff --git a/docs/src/pages/components/checkboxes/CheckboxLabels.js b/docs/src/pages/components/checkboxes/CheckboxLabels.js index c6a3e9ec8a9471..0423018486cff4 100644 --- a/docs/src/pages/components/checkboxes/CheckboxLabels.js +++ b/docs/src/pages/components/checkboxes/CheckboxLabels.js @@ -27,23 +27,21 @@ export default function CheckboxLabels() { checkedG: true, }); - const handleChange = name => event => { - setState({ ...state, [name]: event.target.checked }); + const handleChange = event => { + setState({ ...state, [event.target.value]: event.target.checked }); }; return ( - } + control={} label="Secondary" /> @@ -57,7 +55,7 @@ export default function CheckboxLabels() { control={ @@ -66,11 +64,7 @@ export default function CheckboxLabels() { /> + } label="Custom color" /> diff --git a/docs/src/pages/components/checkboxes/CheckboxLabels.tsx b/docs/src/pages/components/checkboxes/CheckboxLabels.tsx index 07c80da8edc61a..a02de6ca69dec7 100644 --- a/docs/src/pages/components/checkboxes/CheckboxLabels.tsx +++ b/docs/src/pages/components/checkboxes/CheckboxLabels.tsx @@ -27,23 +27,21 @@ export default function CheckboxLabels() { checkedG: true, }); - const handleChange = (name: string) => (event: React.ChangeEvent) => { - setState({ ...state, [name]: event.target.checked }); + const handleChange = (event: React.ChangeEvent) => { + setState({ ...state, [event.target.value]: event.target.checked }); }; return ( - } + control={} label="Secondary" /> @@ -57,7 +55,7 @@ export default function CheckboxLabels() { control={ @@ -66,11 +64,7 @@ export default function CheckboxLabels() { /> + } label="Custom color" /> diff --git a/docs/src/pages/components/checkboxes/CheckboxesGroup.js b/docs/src/pages/components/checkboxes/CheckboxesGroup.js index a6f3020dd7e966..2e07130f10d1a0 100644 --- a/docs/src/pages/components/checkboxes/CheckboxesGroup.js +++ b/docs/src/pages/components/checkboxes/CheckboxesGroup.js @@ -24,8 +24,8 @@ export default function CheckboxesGroup() { antoine: false, }); - const handleChange = name => event => { - setState({ ...state, [name]: event.target.checked }); + const handleChange = event => { + setState({ ...state, [event.target.value]: event.target.checked }); }; const { gilad, jason, antoine } = state; @@ -37,17 +37,15 @@ export default function CheckboxesGroup() { Assign responsibility } + control={} label="Gilad Gray" /> } + control={} label="Jason Killian" /> - } + control={} label="Antoine Llorca" /> @@ -57,17 +55,15 @@ export default function CheckboxesGroup() { Pick two } + control={} label="Gilad Gray" /> } + control={} label="Jason Killian" /> - } + control={} label="Antoine Llorca" /> diff --git a/docs/src/pages/components/checkboxes/CheckboxesGroup.tsx b/docs/src/pages/components/checkboxes/CheckboxesGroup.tsx index fe859874e9904c..8ec0ac757d6443 100644 --- a/docs/src/pages/components/checkboxes/CheckboxesGroup.tsx +++ b/docs/src/pages/components/checkboxes/CheckboxesGroup.tsx @@ -26,8 +26,8 @@ export default function CheckboxesGroup() { antoine: false, }); - const handleChange = (name: string) => (event: React.ChangeEvent) => { - setState({ ...state, [name]: event.target.checked }); + const handleChange = (event: React.ChangeEvent) => { + setState({ ...state, [event.target.value]: event.target.checked }); }; const { gilad, jason, antoine } = state; @@ -39,17 +39,15 @@ export default function CheckboxesGroup() { Assign responsibility } + control={} label="Gilad Gray" /> } + control={} label="Jason Killian" /> - } + control={} label="Antoine Llorca" /> @@ -59,17 +57,15 @@ export default function CheckboxesGroup() { Pick two } + control={} label="Gilad Gray" /> } + control={} label="Jason Killian" /> - } + control={} label="Antoine Llorca" />