mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-09 15:05:44 +01:00
33 lines
640 B
JavaScript
33 lines
640 B
JavaScript
|
|
//@flow
|
||
|
|
import React from "react";
|
||
|
|
import classNames from "classnames";
|
||
|
|
|
||
|
|
export type ButtonProps = {
|
||
|
|
label: string,
|
||
|
|
loading?: boolean,
|
||
|
|
disabled?: boolean,
|
||
|
|
action: () => void
|
||
|
|
};
|
||
|
|
|
||
|
|
type Props = ButtonProps & {
|
||
|
|
type: string
|
||
|
|
};
|
||
|
|
|
||
|
|
class Button extends React.Component<Props> {
|
||
|
|
render() {
|
||
|
|
const { label, loading, disabled, type, action } = this.props;
|
||
|
|
const loadingClass = loading ? "is-loading" : "";
|
||
|
|
return (
|
||
|
|
<button
|
||
|
|
disabled={disabled}
|
||
|
|
onClick={action}
|
||
|
|
className={classNames("button", "is-" + type, loadingClass)}
|
||
|
|
>
|
||
|
|
{label}
|
||
|
|
</button>
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
export default Button;
|