"use client"; import { ArrowPathIcon } from "@heroicons/react/24/outline"; import clsx from "clsx"; import type { ComponentProps } from "react"; import { Button as ReactAriaButton } from "react-aria-components"; import { Link } from "../Link"; type VariantProps = { variant?: "secondary" | undefined; size?: "small" | "nopad" | "noshrink" | undefined; }; type ButtonProps = Omit, "isDisabled"> & VariantProps & { isLoading?: boolean | undefined; isDisabled?: boolean | undefined; }; export const Button = ({ isLoading, variant, size, isDisabled, className, children, ...props }: ButtonProps) => ( {(values) => ( <>
{typeof children === "function" ? children(values) : children}
)}
); type LinkButtonProps = ComponentProps & VariantProps; export const LinkButton = ({ variant, size, className, ...props }: LinkButtonProps) => ( ); const baseClassName = (props: VariantProps) => clsx( "border border-pythpurple-600 text-center transition duration-100 hover:bg-pythpurple-600/60 focus:outline-none focus-visible:ring-1 focus-visible:ring-pythpurple-400", variantClassName(props.variant), sizeClassName(props.size), ); const variantClassName = (variant: VariantProps["variant"]) => { switch (variant) { case "secondary": { return "bg-pythpurple-600/20"; } case undefined: { return "bg-pythpurple-600/50"; } } }; const sizeClassName = (size: VariantProps["size"]) => { switch (size) { case "small": { return "text-sm px-2 sm:px-3 py-1"; } case "nopad": { return ""; } case "noshrink": { return "px-8 py-2"; } case undefined: { return "px-2 sm:px-4 md:px-8 py-2"; } } };