forked from
slices.network/slices
Highly ambitious ATProtocol AppView service and sdks
1import { cn } from "../utils/cn.ts";
2
3interface IconButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
4 children: React.ReactNode;
5 variant?: "default" | "ghost";
6 size?: "sm" | "md";
7}
8
9export function IconButton({ children, variant = "ghost", size = "md", className, ...props }: IconButtonProps) {
10 const sizeClasses = {
11 sm: "p-0.5",
12 md: "p-1",
13 };
14
15 const variantClasses = variant === "ghost"
16 ? "text-zinc-600 hover:text-zinc-400 hover:bg-zinc-800"
17 : "text-zinc-400 hover:text-zinc-300 hover:bg-zinc-800";
18
19 return (
20 <button
21 type="button"
22 className={cn(
23 "rounded transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",
24 sizeClasses[size],
25 variantClasses,
26 className
27 )}
28 {...props}
29 >
30 {children}
31 </button>
32 );
33}