mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 23:45:44 +01:00
scm-ui: new repository layout
This commit is contained in:
34
scm-ui/ui-components/src/buttons/SubmitButton.js
Normal file
34
scm-ui/ui-components/src/buttons/SubmitButton.js
Normal file
@@ -0,0 +1,34 @@
|
||||
//@flow
|
||||
import React from "react";
|
||||
import Button, { type ButtonProps } from "./Button";
|
||||
|
||||
type SubmitButtonProps = ButtonProps & {
|
||||
scrollToTop: boolean
|
||||
}
|
||||
|
||||
class SubmitButton extends React.Component<SubmitButtonProps> {
|
||||
static defaultProps = {
|
||||
scrollToTop: true
|
||||
};
|
||||
|
||||
render() {
|
||||
const { action, scrollToTop } = this.props;
|
||||
return (
|
||||
<Button
|
||||
type="submit"
|
||||
color="primary"
|
||||
{...this.props}
|
||||
action={(event) => {
|
||||
if (action) {
|
||||
action(event);
|
||||
}
|
||||
if (scrollToTop) {
|
||||
window.scrollTo(0, 0);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default SubmitButton;
|
||||
Reference in New Issue
Block a user