show loading state on buttons in UserRow

This commit is contained in:
Sebastian Sdorra
2018-07-18 09:35:16 +02:00
parent ef4d4b8f02
commit 837824c0e3
11 changed files with 8486 additions and 55 deletions

View File

@@ -0,0 +1,32 @@
//@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;