2
0

feat(inputs): Add Date input

This commit is contained in:
Baptiste Arnaud
2022-01-10 08:05:03 +01:00
parent ce1b23a0e7
commit 8cba7ff37b
21 changed files with 305 additions and 100 deletions

View File

@ -2,12 +2,14 @@ import { FormLabel, HStack, Switch, SwitchProps } from '@chakra-ui/react'
import React, { useState } from 'react'
type SwitchWithLabelProps = {
id: string
label: string
initialValue: boolean
onCheckChange: (isChecked: boolean) => void
} & SwitchProps
export const SwitchWithLabel = ({
id,
label,
initialValue,
onCheckChange,
@ -21,10 +23,15 @@ export const SwitchWithLabel = ({
}
return (
<HStack justifyContent="space-between">
<FormLabel htmlFor={props.id} mb="0">
<FormLabel htmlFor={id} mb="0">
{label}
</FormLabel>
<Switch isChecked={isChecked} onChange={handleChange} {...props} />
<Switch
isChecked={isChecked}
onChange={handleChange}
id={id}
{...props}
/>
</HStack>
)
}