🐛 fix(switch.tsx): add aria-disabled attribute to the Switch component to improve accessibility

🎨 style(switch.tsx): update class names in the Switch component to improve readability and maintainability
This commit is contained in:
Lucas Oliveira 2023-06-30 12:54:07 -03:00
commit 61e87a6d54

View file

@ -17,8 +17,9 @@ const Switch = React.forwardRef<
ref={ref} ref={ref}
> >
<SwitchPrimitives.Thumb <SwitchPrimitives.Thumb
aria-disabled={props.disabled}
className={cn( className={cn(
"pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0" "pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 aria-disabled:bg-muted/70 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0"
)} )}
/> />
</SwitchPrimitives.Root> </SwitchPrimitives.Root>