"use client";
import {
forwardRef,
type AnchorHTMLAttributes,
type ButtonHTMLAttributes,
type ReactNode,
} from "react";
import { Spinner } from "./Spinner.tsx";
import { Anchor } from "./Link.tsx";
export type ButtonVariant = "solid" | "ghost" | "inverse";
export type ButtonSize = "md" | "sm";
function Arrow() {
return (
);
}
const buttonClass = (
variant: ButtonVariant,
size: ButtonSize,
className: string,
) =>
`mizu-btn mizu-btn--${variant} mizu-btn--${size}${className ? ` ${className}` : ""}`;
export interface ButtonProps extends ButtonHTMLAttributes {
variant?: ButtonVariant;
size?: ButtonSize;
loading?: boolean;
arrow?: boolean;
}
export const Button = forwardRef(
function Button(
{
variant = "solid",
size = "md",
loading = false,
arrow = true,
className = "",
children,
disabled,
type = "button",
...props
},
ref,
) {
return (
);
},
);
export interface ButtonLinkProps extends AnchorHTMLAttributes {
variant?: ButtonVariant;
size?: ButtonSize;
arrow?: boolean;
label?: string;
children: ReactNode;
}
export function ButtonLink({
variant = "solid",
size = "md",
arrow = true,
label,
className = "",
children,
...props
}: ButtonLinkProps) {
return (
{children}
{arrow && }
);
}