mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 07:25:44 +01:00
show loading state on buttons in UserRow
This commit is contained in:
32
scm-ui/src/components/Button.js
Normal file
32
scm-ui/src/components/Button.js
Normal 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;
|
||||
Reference in New Issue
Block a user