mirror of
https://github.com/nihonbuzz/nihonbuzz-academy.git
synced 2026-01-26 13:32:07 +07:00
first commit
This commit is contained in:
34
resources/js/Components/Checkbox.tsx
Normal file
34
resources/js/Components/Checkbox.tsx
Normal file
@@ -0,0 +1,34 @@
|
||||
import { Checkbox as ShadcnCheckbox } from '@/Components/ui/checkbox';
|
||||
|
||||
export default function Checkbox({
|
||||
className = '',
|
||||
checked,
|
||||
onChange,
|
||||
onCheckedChange,
|
||||
...props
|
||||
}: any) {
|
||||
const handleChange = (val: boolean) => {
|
||||
if (onCheckedChange) onCheckedChange(val);
|
||||
if (onChange) {
|
||||
onChange({
|
||||
target: {
|
||||
name: props.name,
|
||||
checked: val,
|
||||
type: 'checkbox'
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<ShadcnCheckbox
|
||||
{...props}
|
||||
checked={checked}
|
||||
onCheckedChange={handleChange}
|
||||
className={
|
||||
'rounded border-gray-300 ' +
|
||||
className
|
||||
}
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user