You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.1 KiB
55 lines
1.1 KiB
7 years ago
|
import PropTypes from 'prop-types';
|
||
|
import React from 'react';
|
||
|
import classNames from 'classnames';
|
||
|
import Button from 'Components/Link/Button';
|
||
|
import SpinnerButton from 'Components/Link/SpinnerButton';
|
||
|
import { kinds } from 'Helpers/Props';
|
||
|
import styles from './FormInputButton.css';
|
||
|
|
||
|
function FormInputButton(props) {
|
||
|
const {
|
||
|
className,
|
||
|
canSpin,
|
||
|
isLastButton,
|
||
|
...otherProps
|
||
|
} = props;
|
||
|
|
||
|
if (canSpin) {
|
||
|
return (
|
||
|
<SpinnerButton
|
||
|
className={classNames(
|
||
|
className,
|
||
|
!isLastButton && styles.middleButton
|
||
|
)}
|
||
|
kind={kinds.PRIMARY}
|
||
|
{...otherProps}
|
||
|
/>
|
||
|
);
|
||
|
}
|
||
|
|
||
|
return (
|
||
|
<Button
|
||
|
className={classNames(
|
||
|
className,
|
||
|
!isLastButton && styles.middleButton
|
||
|
)}
|
||
|
kind={kinds.PRIMARY}
|
||
|
{...otherProps}
|
||
|
/>
|
||
|
);
|
||
|
}
|
||
|
|
||
|
FormInputButton.propTypes = {
|
||
|
className: PropTypes.string.isRequired,
|
||
|
isLastButton: PropTypes.bool.isRequired,
|
||
|
canSpin: PropTypes.bool.isRequired
|
||
|
};
|
||
|
|
||
|
FormInputButton.defaultProps = {
|
||
|
className: styles.button,
|
||
|
isLastButton: true,
|
||
|
canSpin: false
|
||
|
};
|
||
|
|
||
|
export default FormInputButton;
|