Skip to content

Commit 3791d3f

Browse files
committed
improvement(switch): dark styling
1 parent be2a9ef commit 3791d3f

File tree

2 files changed

+5
-14
lines changed

2 files changed

+5
-14
lines changed

apps/sim/components/emcn/components/switch/switch.tsx

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ import * as SwitchPrimitives from '@radix-ui/react-switch'
55
import { cn } from '@/lib/core/utils/cn'
66

77
/**
8-
* Custom switch component with thin track design.
9-
* Track: 28px width, 6px height, 20px border-radius
10-
* Thumb: 14px diameter circle that overlaps the track
8+
* Switch component styled to match Sim's design system.
9+
* Uses brand color for checked state, neutral border for unchecked.
1110
*/
1211
const Switch = React.forwardRef<
1312
React.ElementRef<typeof SwitchPrimitives.Root>,
@@ -16,21 +15,13 @@ const Switch = React.forwardRef<
1615
<SwitchPrimitives.Root
1716
disabled={disabled}
1817
className={cn(
19-
'peer inline-flex h-[17px] w-[30px] shrink-0 cursor-pointer items-center rounded-[20px] transition-colors focus-visible:outline-none',
20-
'data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50',
21-
'bg-[var(--border-1)] data-[state=checked]:bg-[var(--text-primary)]',
18+
'peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full bg-[var(--border-1)] transition-colors focus-visible:outline-none data-[disabled]:cursor-not-allowed data-[state=checked]:bg-[var(--brand-tertiary-2)] data-[disabled]:opacity-50',
2219
className
2320
)}
2421
{...props}
2522
ref={ref}
2623
>
27-
<SwitchPrimitives.Thumb
28-
className={cn(
29-
'pointer-events-none block h-[14px] w-[14px] rounded-full shadow-sm ring-0 transition-transform',
30-
'bg-[var(--white)]',
31-
'data-[state=checked]:translate-x-[14px] data-[state=unchecked]:translate-x-[2px]'
32-
)}
33-
/>
24+
<SwitchPrimitives.Thumb className='pointer-events-none block h-4 w-4 rounded-full bg-[var(--white)] shadow-sm ring-0 transition-transform data-[state=checked]:translate-x-[18px] data-[state=unchecked]:translate-x-0.5' />
3425
</SwitchPrimitives.Root>
3526
))
3627

bun.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)