mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 05:10:31 +00:00
feat: apply new cards design system.
feat: empty status datatables. fix: edit account.
This commit is contained in:
27
client/src/components/Forms/Checkbox.tsx
Normal file
27
client/src/components/Forms/Checkbox.tsx
Normal file
@@ -0,0 +1,27 @@
|
||||
import React, { useState } from 'react';
|
||||
import {
|
||||
Checkbox as BPCheckbox,
|
||||
} from '@blueprintjs/core';
|
||||
|
||||
export default function CheckboxComponent(props) {
|
||||
const { field, form, ...rest } = props;
|
||||
const [value, setValue] = useState(field.value || false);
|
||||
|
||||
const handleChange = () => {
|
||||
const checked = !value;
|
||||
form.setFieldValue(field.name, checked);
|
||||
setValue(checked);
|
||||
};
|
||||
|
||||
const handleBlur = () => {
|
||||
form.setFieldTouched(field.name);
|
||||
};
|
||||
|
||||
const checkboxProps = {
|
||||
...rest,
|
||||
onChange: handleChange,
|
||||
onBlur: handleBlur,
|
||||
checked: value,
|
||||
}
|
||||
return <BPCheckbox {...checkboxProps} />;
|
||||
}
|
||||
Reference in New Issue
Block a user