mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-05-06 05:07:36 -05:00
26 lines
612 B
TypeScript
26 lines
612 B
TypeScript
import classNames from "classnames";
|
|
import * as React from "react";
|
|
|
|
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
variant?: "outlined";
|
|
loading?: boolean;
|
|
loadingText?: string;
|
|
"data-cy"?: string;
|
|
}
|
|
|
|
export function Button(props: ButtonProps) {
|
|
const { variant, loading, children, loadingText, ...rest } = props;
|
|
return (
|
|
<button
|
|
className={classNames({
|
|
outlined: variant === "outlined",
|
|
loading: loading,
|
|
})}
|
|
disabled={loading}
|
|
{...rest}
|
|
>
|
|
{loading && loadingText ? loadingText : children}
|
|
</button>
|
|
);
|
|
}
|