Skip to content

Commit

Permalink
feat(SwitchV2): highlight red when checked
Browse files Browse the repository at this point in the history
  • Loading branch information
he3als committed Aug 12, 2024
1 parent 7cb4c2b commit 616a93c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions resources/scripts/components/elements/SwitchV2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@ const Switch = React.forwardRef<
>(({ className, ...props }, ref) => (
<SwitchPrimitives.Root
className={cn(
'peer inline-flex h-7 w-14 shrink-0 cursor-pointer items-center rounded-full border-[1px] border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 bg-gradient-to-b from-[#ffffff10] to-[#ffffff09]',
'peer inline-flex h-7 w-14 shrink-0 cursor-pointer items-center rounded-full p-px transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 bg-gradient-to-b from-[#ffffff0f] to-[#ffffff0a]',
'data-[state=checked]:bg-[#fa4f49f5]',
className,
)}
{...props}
ref={ref}
>
<SwitchPrimitives.Thumb
className={cn(
'pointer-events-none block h-6 w-6 rounded-full bg-gradient-to-br from-[#ffffff50] to-[#ffffff20] inner-border-[1px] inner-border-[#ffffff15] shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-7 data-[state=unchecked]:translate-x-0',
'pointer-events-none block h-6 w-6 rounded-full bg-gradient-to-br from-[#ffffffcf] to-[#ffffffa1] inner-border-[1px] shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-7 data-[state=unchecked]:translate-x-0.5',
)}
/>
</SwitchPrimitives.Root>
Expand Down

0 comments on commit 616a93c

Please sign in to comment.