mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-09 15:05:44 +01:00
SubmitButton: scroll to top after performing action
This commit is contained in:
@@ -4,12 +4,16 @@ import Button, { type ButtonProps } from "./Button";
|
|||||||
|
|
||||||
class SubmitButton extends React.Component<ButtonProps> {
|
class SubmitButton extends React.Component<ButtonProps> {
|
||||||
render() {
|
render() {
|
||||||
|
const { action } = this.props;
|
||||||
return (
|
return (
|
||||||
<Button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
color="primary"
|
color="primary"
|
||||||
{...this.props}
|
{...this.props}
|
||||||
action={() => {
|
action={(event) => {
|
||||||
|
if (action) {
|
||||||
|
action(event)
|
||||||
|
}
|
||||||
window.scrollTo(0, 0);
|
window.scrollTo(0, 0);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user