diff options
Diffstat (limited to 'FrontEnd/src/views/common/button/LoadingButton.tsx')
-rw-r--r-- | FrontEnd/src/views/common/button/LoadingButton.tsx | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/FrontEnd/src/views/common/button/LoadingButton.tsx b/FrontEnd/src/views/common/button/LoadingButton.tsx new file mode 100644 index 00000000..aee83aa2 --- /dev/null +++ b/FrontEnd/src/views/common/button/LoadingButton.tsx @@ -0,0 +1,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; |