fix: resolve TypeScript errors in migrated components
This commit is contained in:
28
apps/web/src/components/ui/switch.tsx
Normal file
28
apps/web/src/components/ui/switch.tsx
Normal file
@@ -0,0 +1,28 @@
|
||||
import * as React from "react";
|
||||
|
||||
export interface SwitchProps {
|
||||
id?: string;
|
||||
checked?: boolean;
|
||||
onCheckedChange?: (checked: boolean) => void;
|
||||
disabled?: boolean;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export const Switch = React.forwardRef<HTMLInputElement, SwitchProps>(
|
||||
({ id, checked, onCheckedChange, disabled, className = "" }, ref) => {
|
||||
return (
|
||||
<input
|
||||
type="checkbox"
|
||||
role="switch"
|
||||
ref={ref}
|
||||
id={id}
|
||||
checked={checked}
|
||||
onChange={(e) => onCheckedChange?.(e.target.checked)}
|
||||
disabled={disabled}
|
||||
className={`w-11 h-6 rounded-full ${className}`}
|
||||
/>
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
Switch.displayName = "Switch";
|
||||
Reference in New Issue
Block a user