blob: cd9f1adce6b51e2c5768f7ad3465f4dcdb11b353 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
import React from "react";
import { Button, ButtonProps, Spinner } from "react-bootstrap";
const LoadingButton: React.FC<{ loading?: boolean } & ButtonProps> = ({
loading,
variant,
disabled,
...otherProps
}) => {
return (
<Button
variant={variant != null ? `outline-${variant}` : "outline-primary"}
disabled={disabled || loading}
{...otherProps}
>
{otherProps.children}
{loading ? (
<Spinner
className="ms-1"
variant={variant}
animation="grow"
size="sm"
/>
) : null}
</Button>
);
};
export default LoadingButton;
|