/*
  pill-link.tsx
  spboucher.ai Web
  Author: Simon-Pierre Boucher
  Mail: contact@spboucher.ai
*/

import type { LucideIcon } from "lucide-react";

import { cn } from "@/lib/utils";

interface PillLinkProps {
  href: string;
  icon?: LucideIcon;
  children: React.ReactNode;
  external?: boolean;
  className?: string;
}

/** A rounded, chip-style link for documents and resources. */
export function PillLink({
  href,
  icon: Icon,
  children,
  external = true,
  className,
}: PillLinkProps) {
  return (
    <a
      href={href}
      {...(external
        ? { target: "_blank", rel: "noopener noreferrer" }
        : undefined)}
      className={cn(
        "inline-flex items-center gap-1.5 rounded-[0.5rem] border border-foreground/15 bg-card px-3 py-1.5 text-xs font-medium text-foreground/80 shadow-[var(--shadow-soft)] transition-all hover:-translate-y-px hover:border-primary/50 hover:text-primary",
        className,
      )}
    >
      {Icon && <Icon className="h-3.5 w-3.5" aria-hidden="true" />}
      {children}
    </a>
  );
}
