From 5abaac66bd29c13922bc782686b9345cdf8a83d5 Mon Sep 17 00:00:00 2001 From: Thu Pham Date: Mon, 11 Mar 2024 11:45:43 -0700 Subject: [PATCH] remove additional parens --- src/antd/Checkbox.tsx | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/src/antd/Checkbox.tsx b/src/antd/Checkbox.tsx index 87de437..eb1d5d3 100644 --- a/src/antd/Checkbox.tsx +++ b/src/antd/Checkbox.tsx @@ -1,26 +1,38 @@ -import { CellProps, WithClassname, Helpers } from "@jsonforms/core" -import { Checkbox as AntDCheckbox } from "antd" -import { CheckboxChangeEvent } from "antd/es/checkbox" +import { CellProps, WithClassname, Helpers } from "@jsonforms/core"; +import { Checkbox as AntDCheckbox } from "antd"; +import { CheckboxChangeEvent } from "antd/es/checkbox"; interface CheckboxProps extends CellProps, WithClassname { - label?: string + label?: string; } -export function Checkbox({ data, className, id, enabled, uischema, schema, path, handleChange, label } : CheckboxProps) { - const checked = !!data // convert undefined to false +export function Checkbox({ + data, + className, + id, + enabled, + uischema, + schema, + path, + handleChange, + label, +}: CheckboxProps) { + const checked = !!data; // convert undefined to false const labelDescription = Helpers.createLabelDescriptionFrom(uischema, schema); - const defaultLabel = labelDescription.show ? labelDescription.text : ''; + const defaultLabel = labelDescription.show ? labelDescription.text : ""; return ( {handleChange(path, e.target.checked)}} + onChange={(e: CheckboxChangeEvent) => + handleChange(path, e.target.checked) + } className={className} id={id} disabled={!enabled} > {label ?? defaultLabel} - ) + ); }