mirror of
https://github.com/zhom/donutbrowser.git
synced 2026-05-02 00:25:11 +02:00
26 lines
580 B
TypeScript
26 lines
580 B
TypeScript
import { LuLoaderCircle } from "react-icons/lu";
|
|
import {
|
|
type RippleButtonProps as ButtonProps,
|
|
RippleButton as UIButton,
|
|
} from "./ui/ripple";
|
|
|
|
type Props = ButtonProps & {
|
|
isLoading: boolean;
|
|
"aria-label"?: string;
|
|
};
|
|
export const LoadingButton = ({ isLoading, ...props }: Props) => {
|
|
return (
|
|
<UIButton
|
|
className="grid place-items-center"
|
|
{...props}
|
|
disabled={props.disabled || isLoading}
|
|
>
|
|
{isLoading ? (
|
|
<LuLoaderCircle className="h-4 w-4 animate-spin" />
|
|
) : (
|
|
props.children
|
|
)}
|
|
</UIButton>
|
|
);
|
|
};
|