create foor
This commit is contained in:
@@ -25,7 +25,7 @@ const Select: FC<Props> = (props: Props) => {
|
||||
</label>
|
||||
}
|
||||
<select {...props} className={clx(
|
||||
'w-full text-black block border appearance-none border-border px-2.5 h-10 text-sm rounded-2.5 bg-gray',
|
||||
'w-full text-black block border appearance-none border-border px-2.5 h-10 text-sm rounded-[10px] bg-gray',
|
||||
props.className,
|
||||
props.label && 'mt-1'
|
||||
)}>
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
import { Fragment } from 'react'
|
||||
import { Switch } from '@headlessui/react'
|
||||
import MoonLoader from 'react-spinners/MoonLoader'
|
||||
|
||||
interface Props {
|
||||
active: boolean,
|
||||
onChange: (value: boolean) => void,
|
||||
isLoading?: boolean,
|
||||
label?: string,
|
||||
}
|
||||
|
||||
const SwitchComponent = (props: Props) => {
|
||||
|
||||
const handleChange = (value: boolean) => {
|
||||
props.onChange(value)
|
||||
}
|
||||
|
||||
if (props.isLoading) {
|
||||
return (
|
||||
<MoonLoader size={20} color='black' className='ml-4' />
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='dltr w-fit flex gap-2 items-center'>
|
||||
<Switch checked={props.active} onChange={handleChange} as={Fragment}>
|
||||
{({ checked }) => (
|
||||
<button
|
||||
className={`${checked ? 'bg-primary' : 'bg-gray-200'
|
||||
} relative inline-flex h-6 w-11 items-center rounded-full`}
|
||||
>
|
||||
<span className="sr-only">Enable notifications</span>
|
||||
<span
|
||||
className={`${checked ? 'translate-x-6' : 'translate-x-1'
|
||||
} inline-block h-4 w-4 transform rounded-full bg-white transition`}
|
||||
/>
|
||||
</button>
|
||||
)}
|
||||
</Switch>
|
||||
{
|
||||
props.label &&
|
||||
<div className='text-sm'>
|
||||
: {props.label}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default SwitchComponent
|
||||
Reference in New Issue
Block a user