aboutsummaryrefslogtreecommitdiff
path: root/FrontEnd/src/views/common/button/LoadingButton.tsx
blob: a7e34f9122e2cf569008f970892894485d94a104 (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
import React from "react";

import { CommonButtonProps } from "./common";
import Button from "./Button";
import Spinner from "../Spinner";

const LoadingButton: React.FC<{ loading?: boolean } & CommonButtonProps> = ({
  loading,
  disabled,
  color,
  ...otherProps
}) => {
  return (
    <Button
      color={color}
      outline
      disabled={disabled || loading}
      {...otherProps}
    >
      {otherProps.children}
      {loading ? (
        <Spinner className="cru-align-text-bottom ms-1" color={color} />
      ) : null}
    </Button>
  );
};

export default LoadingButton;