|
@@ -3,11 +3,13 @@ import StyledButton, {
|
|
} from 'components/common/Button/Button.styled';
|
|
} from 'components/common/Button/Button.styled';
|
|
import React from 'react';
|
|
import React from 'react';
|
|
import { Link } from 'react-router-dom';
|
|
import { Link } from 'react-router-dom';
|
|
|
|
+import Spinner from 'components/common/Spinner/Spinner';
|
|
|
|
|
|
export interface Props
|
|
export interface Props
|
|
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
|
|
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
|
|
ButtonProps {
|
|
ButtonProps {
|
|
to?: string | object;
|
|
to?: string | object;
|
|
|
|
+ inProgress?: boolean;
|
|
}
|
|
}
|
|
|
|
|
|
export const Button: React.FC<Props> = ({ to, ...props }) => {
|
|
export const Button: React.FC<Props> = ({ to, ...props }) => {
|
|
@@ -20,5 +22,16 @@ export const Button: React.FC<Props> = ({ to, ...props }) => {
|
|
</Link>
|
|
</Link>
|
|
);
|
|
);
|
|
}
|
|
}
|
|
- return <StyledButton type="button" {...props} />;
|
|
|
|
|
|
+ return (
|
|
|
|
+ <StyledButton
|
|
|
|
+ type="button"
|
|
|
|
+ disabled={props.disabled || props.inProgress}
|
|
|
|
+ {...props}
|
|
|
|
+ >
|
|
|
|
+ {props.children}{' '}
|
|
|
|
+ {props.inProgress ? (
|
|
|
|
+ <Spinner size={16} borderWidth={2} marginLeft={2} emptyBorderColor />
|
|
|
|
+ ) : null}
|
|
|
|
+ </StyledButton>
|
|
|
|
+ );
|
|
};
|
|
};
|