File size: 1,032 Bytes
d530f14
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
39
40
41
42
43
44
45
46
47
48
49
import Link from "next/link";
import { cn } from "@/utils/cn";

interface FireActionLinkProps {
  href?: string;
  label: string;
  className?: string;
  variant?: "link" | "button";
  onClick?: () => void;
}

export function FireActionLink({
  href,
  label,
  className,
  variant = "link",
  onClick,
}: FireActionLinkProps) {
  const baseClasses =
    variant === "button"
      ? cn(
          "inline-block py-4 px-8 rounded-6",
          "text-label-small text-heat-100 bg-heat-4",
          "hover:bg-heat-8 transition-all",
          "active:scale-[0.98]",
          className,
        )
      : cn(
          "text-label-small text-secondary hover:text-heat-100 transition-all",
          "hover:underline underline-offset-4",
          "active:scale-[0.98]",
          className,
        );

  if (onClick) {
    return (
      <button onClick={onClick} className={baseClasses}>
        {label}
      </button>
    );
  }

  return (
    <Link href={href || "#"} className={baseClasses}>
      {label}
    </Link>
  );
}