+
+ {/* Always open pages from top when route changes */}
+
+
+
} />
@@ -46,7 +58,12 @@ function App() {
} />
+
+
+ {/* Floating scroll button */}
+
+
);
diff --git a/src/components/ScrollRestoration.jsx b/src/components/ScrollRestoration.jsx
new file mode 100644
index 0000000..f6cf871
--- /dev/null
+++ b/src/components/ScrollRestoration.jsx
@@ -0,0 +1,15 @@
+import { useEffect } from "react";
+import { useLocation } from "react-router-dom";
+
+export default function ScrollRestoration() {
+ const { pathname } = useLocation();
+
+ useEffect(() => {
+ window.scrollTo({
+ top: 0,
+ behavior: "instant",
+ });
+ }, [pathname]);
+
+ return null;
+}
diff --git a/src/components/ScrollToTop.jsx b/src/components/ScrollToTop.jsx
new file mode 100644
index 0000000..e390356
--- /dev/null
+++ b/src/components/ScrollToTop.jsx
@@ -0,0 +1,48 @@
+import { useEffect, useState } from "react";
+
+export default function ScrollToTop() {
+ const [visible, setVisible] = useState(false);
+
+ useEffect(() => {
+ const toggleVisibility = () => {
+ setVisible(window.scrollY > 300);
+ };
+
+ window.addEventListener("scroll", toggleVisibility);
+ return () => window.removeEventListener("scroll", toggleVisibility);
+ }, []);
+
+ const scrollTop = () => {
+ window.scrollTo({
+ top: 0,
+ behavior: "smooth",
+ });
+ };
+
+ return (
+