aboutsummaryrefslogtreecommitdiff
path: root/src/components/configuration/checkBoxWrapper.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/configuration/checkBoxWrapper.tsx')
-rw-r--r--src/components/configuration/checkBoxWrapper.tsx37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/components/configuration/checkBoxWrapper.tsx b/src/components/configuration/checkBoxWrapper.tsx
new file mode 100644
index 0000000..e9dd1eb
--- /dev/null
+++ b/src/components/configuration/checkBoxWrapper.tsx
@@ -0,0 +1,37 @@
+import ConfigType from '../../../common/types/configType'
+
+type CheckBoxProps = {
+ title: string
+ keyName: keyof ConfigType
+ checked?: boolean
+ disabled?: boolean
+
+ handleChange: (value: any, key: keyof ConfigType) => void
+}
+
+const CheckBoxWrapper = ({
+ title,
+ keyName,
+ checked,
+ disabled,
+ handleChange
+}: CheckBoxProps) => {
+ return (
+ <div className="form-control">
+ <label className="label cursor-pointer justify-start gap-2">
+ <input
+ className="checkbox checkbox-sm"
+ type="checkbox"
+ checked={!!checked}
+ disabled={disabled}
+ onChange={(e) => {
+ handleChange({ state: e.target.checked }, keyName)
+ }}
+ />
+ <span className="label-text">{title}</span>
+ </label>
+ </div>
+ )
+}
+
+export default CheckBoxWrapper