gc-wing/packages/ui/src/components/ToggleButton.tsx

25 lines
681 B
TypeScript
Raw Normal View 히스토리

import type { ButtonHTMLAttributes, ReactNode } from 'react';
import { cn } from '../utils/cn.ts';
interface ToggleButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
on?: boolean;
children: ReactNode;
}
export function ToggleButton({ on, className, children, ...props }: ToggleButtonProps) {
return (
<button
className={cn(
'cursor-pointer rounded border px-1.5 py-0.5 text-[8px] transition-all duration-150 select-none',
on
? 'border-wing-accent bg-wing-accent text-white'
: 'border-wing-border bg-wing-card text-wing-muted',
className,
)}
{...props}
>
{children}
</button>
);
}