Files
SCM-Manager/scm-ui/src/components/SubmitButton.js

43 lines
931 B
JavaScript
Raw Normal View History

2018-07-11 14:59:01 +02:00
//@flow
import React from "react";
import classNames from "classnames";
type Props = {
value: string,
disabled?: boolean,
isLoading?: boolean,
2018-07-11 14:59:01 +02:00
large?: boolean,
fullWidth?: boolean
};
class SubmitButton extends React.Component<Props> {
render() {
2018-07-11 21:01:29 +02:00
const { value, large, fullWidth, isLoading, disabled } = this.props;
2018-07-11 14:59:01 +02:00
const largeClass = large ? "is-large" : "";
const fullWidthClass = fullWidth ? "is-fullwidth" : "";
2018-07-11 21:01:29 +02:00
const loadingClass = isLoading ? "is-loading" : "";
2018-07-11 14:59:01 +02:00
return (
<div className="field">
<div className="control">
2018-07-11 21:01:29 +02:00
<button
disabled={disabled}
2018-07-11 14:59:01 +02:00
className={classNames(
"button",
"is-link",
largeClass,
2018-07-11 21:01:29 +02:00
fullWidthClass,
loadingClass
2018-07-11 14:59:01 +02:00
)}
2018-07-11 21:01:29 +02:00
>
{value}
</button>
2018-07-11 14:59:01 +02:00
</div>
</div>
);
}
}
export default SubmitButton;