import Link, { LinkProps } from "next/link"; import React, { forwardRef } from "react"; import classNames from "@calcom/lib/classNames"; type SVGComponent = React.FunctionComponent>; export type ButtonBaseProps = { color?: "primary" | "secondary" | "minimal" | "warn" | "alert" | "alert2"; size?: "base" | "sm" | "lg" | "fab" | "icon"; loading?: boolean; disabled?: boolean; onClick?: (event: React.MouseEvent) => void; StartIcon?: SVGComponent; startIconClassName?: string; EndIcon?: SVGComponent; shallow?: boolean; }; export type ButtonProps = ButtonBaseProps & ( | (Omit & { href: LinkProps["href"] }) | (Omit & { href?: never }) ); export const Button = forwardRef(function Button( props: ButtonProps, forwardedRef ) { const { loading = false, color = "primary", size = "base", StartIcon, startIconClassName, EndIcon, shallow, // 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 `