Files
vexplor/frontend/components/ui/switch.tsx
DDD1542 4f10b5e42d refactor: 전체 프론트엔드 하드코딩 색상 → CSS 변수 일괄 치환
447+ 파일, 4500+ 줄 변경:
- gray-* → border/bg-muted/text-foreground/text-muted-foreground
- blue-* → primary/ring
- red-* → destructive
- green-* → emerald (일관성)
- indigo-* → primary
- yellow/orange → amber (통일)
- dark mode 변형도 시맨틱 토큰으로 변환

Made-with: Cursor
2026-03-09 14:31:59 +09:00

34 lines
1.2 KiB
TypeScript

"use client";
import * as React from "react";
import * as SwitchPrimitive from "@radix-ui/react-switch";
import { cn } from "@/lib/utils";
function Switch({ className, ...props }: React.ComponentProps<typeof SwitchPrimitive.Root>) {
return (
<SwitchPrimitive.Root
data-slot="switch"
className={cn(
"peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border border-transparent shadow-sm transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
"data-[state=checked]:bg-emerald-500 data-[state=unchecked]:bg-muted/60",
"hover:data-[state=checked]:bg-emerald-600 hover:data-[state=unchecked]:bg-muted-foreground",
"focus-visible:border-ring focus-visible:ring-ring/50",
className,
)}
{...props}
>
<SwitchPrimitive.Thumb
data-slot="switch-thumb"
className={cn(
"pointer-events-none block h-4 w-4 rounded-full ring-0 transition-transform",
"bg-white shadow-sm",
"data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0.5",
)}
/>
</SwitchPrimitive.Root>
);
}
export { Switch };