File size: 806 Bytes
3201ca6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { cn } from "#/utils/utils";

interface TabButtonProps {
  isActive: boolean;
  children: React.ReactNode;
  onClick: () => void;
  className?: string;
  disabled?: boolean;
}

export function TabButton({
  isActive,
  children,
  onClick,
  className,
  disabled = false,
}: TabButtonProps) {
  return (
    <button
      type="button"
      disabled={disabled}
      className={cn(
        "px-4 py-2 font-normal border-b-2 transition-colors",
        isActive
          ? "border-foreground text-foreground"
          : "border-transparent text-[var(--oh-muted)] hover:text-[var(--oh-foreground)]",
        disabled && "opacity-50 cursor-not-allowed",
        className,
      )}
      onClick={onClick}
      aria-selected={isActive}
      role="tab"
    >
      {children}
    </button>
  );
}