aboutsummaryrefslogtreecommitdiff
path: root/FrontEnd/src/views/common/button/LoadingButton.tsx
blob: aee83aa22c0bac5366b8316582a29d6c67fa5cbc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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} disabled={disabled || loading} {...otherProps}>
      {otherProps.children}
      {loading ? <Spinner color={color} /> : null}
    </Button>
  );
};

export default LoadingButton;