import clsx from "clsx"; import Link from "next/link"; import type { ComponentPropsWithoutRef } from "react"; function ArrowIcon(props: ComponentPropsWithoutRef<"svg">) { return ( ); } const variantStyles = { primary: "rounded-full bg-zinc-900 py-1 px-3 text-white hover:bg-zinc-700 dark:bg-brand-400/10 dark:text-brand-400 dark:ring-1 dark:ring-inset dark:ring-brand-400/20 dark:hover:bg-brand-400/10 dark:hover:text-brand-300 dark:hover:ring-brand-300", secondary: "rounded-full bg-zinc-100 py-1 px-3 text-zinc-900 hover:bg-zinc-200 dark:bg-zinc-800/40 dark:text-zinc-400 dark:ring-1 dark:ring-inset dark:ring-zinc-800 dark:hover:bg-zinc-800 dark:hover:text-zinc-300", filled: "rounded-full bg-zinc-900 py-1 px-3 text-white hover:bg-zinc-700 dark:bg-brand-500 dark:text-white dark:hover:bg-brand-400", outline: "rounded-full py-1 px-3 text-zinc-700 ring-1 ring-inset ring-zinc-900/10 hover:bg-zinc-900/2.5 hover:text-zinc-900 dark:text-zinc-400 dark:ring-white/10 dark:hover:bg-white/5 dark:hover:text-white", text: "text-brand-500 hover:text-brand-600 dark:text-brand-400 dark:hover:text-brand-500", }; type ButtonProps = { variant?: keyof typeof variantStyles; arrow?: "left" | "right"; } & ( | ComponentPropsWithoutRef | (ComponentPropsWithoutRef<"button"> & { href?: undefined }) ); export function Button({ variant = "primary", className, children, arrow, ...props }: ButtonProps) { className = clsx( "inline-flex gap-0.5 justify-center overflow-hidden text-sm font-medium transition", variantStyles[variant], className, ); const arrowIcon = ( ); const inner = ( <> {arrow === "left" && arrowIcon} {children} {arrow === "right" && arrowIcon} ); if (typeof props.href === "undefined") { return ( ); } return ( {inner} ); }