import classNames from "@lib/classNames"; import Link, { LinkProps } from "next/link"; import React from "react"; export type ButtonProps = { color?: "primary" | "secondary" | "minimal"; size?: "base" | "sm" | "lg" | "fab"; loading?: boolean; disabled?: boolean; onClick?: (event: React.MouseEvent) => void; StartIcon?: JSX.IntrinsicElements["svg"]; EndIcon?: JSX.IntrinsicElements["svg"]; } & ( | (Omit & { href: LinkProps["href"] }) | (JSX.IntrinsicElements["button"] & { href?: never }) ); export const Button = function Button(props: ButtonProps) { const { loading = false, color = "primary", size = "base", StartIcon, EndIcon, // attributes propagated from `HTMLAnchorProps` or `HTMLButtonProps` ...passThroughProps } = props; // Buttons are **always** disabled if we're in a `loading` state const disabled = props.disabled || loading; // If pass an `href`-attr is passed it's ``, otherwise it's a `