import React from 'react'
import { Checkbox, Text } from '@chakra-ui/react'

interface Props {
  label: string
  textField: string
  checked: boolean
  defaultIsChecked: boolean
  handleOSChange: any
}

const CheckboxInput = ({ label, textField, checked, defaultIsChecked, handleOSChange }: Props) => {
  return (
    <Checkbox
      defaultChecked={defaultIsChecked}
      isChecked={checked}
      onChange={() => {
        handleOSChange(textField)
      }}
      name={textField}
      spacing="1rem"
    ><Text mt="1">{label}</Text></Checkbox>
  )
}

export default CheckboxInput