Skip to content

Commit 64ecb04

Browse files
committed
Scroll to top after page change
1 parent cebe989 commit 64ecb04

4 files changed

Lines changed: 20 additions & 0 deletions

File tree

public-gui/src/routes/About.jsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,16 @@ import I18n from "../locale/I18n.js";
33
import "./About.scss";
44
import {useAppStore} from "../stores/AppStore.js";
55
import {Background} from "../components/Background.jsx";
6+
import {useEffect} from "react";
67

78
export const About = () => {
89

910
const config = useAppStore((state) => state.config);
1011

12+
useEffect(() => {
13+
window.scroll(0, 0);
14+
}, []);
15+
1116
return (
1217
<div className="about-container">
1318
<div className="about">

public-gui/src/routes/Home.jsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,18 @@ import {useAppStore} from "../stores/AppStore.js";
1010
import {Button} from "@surfnet/sds";
1111
import {Link} from "react-router";
1212
import {Background} from "../components/Background.jsx";
13+
import {useEffect} from "react";
1314

1415
export const Home = () => {
1516

1617
const config = useAppStore((state) => state.config);
1718

1819
const isMobile = "ontouchstart" in window || navigator.maxTouchPoints > 0;
1920

21+
useEffect(() => {
22+
window.scroll(0, 0);
23+
}, []);
24+
2025
return (
2126
<div className="home-container">
2227
<div className="home">

public-gui/src/routes/ServiceDesk.jsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
import I18n from "../locale/I18n.js";
22
import "./ServiceDesk.scss"
33
import FrontDesk from "../assets/frontdesk.svg";
4+
import {useEffect} from "react";
45

56
export const ServiceDesk = () => {
67

8+
useEffect(() => {
9+
window.scroll(0, 0);
10+
}, []);
11+
712
return (
813
<div className="servicedesk-container">
914
<div className="servicedesk">

public-gui/src/routes/Support.jsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,16 @@ import support from "../assets/support.svg";
55
import mobileScreenshot from "../assets/mobile_screenshot.svg";
66
import {Background} from "../components/Background.jsx";
77
import {useAppStore} from "../stores/AppStore.js";
8+
import {useEffect} from "react";
89

910
export const Support = () => {
1011

1112
const config = useAppStore((state) => state.config);
1213

14+
useEffect(() => {
15+
window.scroll(0, 0);
16+
}, []);
17+
1318
return (
1419
<div className="support-container">
1520
<div className="support">

0 commit comments

Comments
 (0)