1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as React from 'react';
6 import Button, { ButtonProps } from '@material-ui/core/Button';
7 import { CircularProgress, withStyles } from '@material-ui/core';
8 import { CircularProgressProps } from '@material-ui/core/CircularProgress';
10 interface ProgressButtonProps extends ButtonProps {
12 progressProps?: CircularProgressProps;
15 export const ProgressButton = ({ loading, progressProps, children, disabled, ...props }: ProgressButtonProps) =>
16 <Button {...props} disabled={disabled || loading}>
18 {loading && <Progress {...progressProps} size={getProgressSize(props.size)} />}
21 const Progress = withStyles({
27 const getProgressSize = (size?: 'small' | 'medium' | 'large') => {