diff --git a/frontend/src/components/navigator.tsx b/frontend/src/components/navigator.tsx index 53c8d25..7aff768 100644 --- a/frontend/src/components/navigator.tsx +++ b/frontend/src/components/navigator.tsx @@ -2,7 +2,7 @@ import { app } from "../app.ts"; import { network } from "../network/network.ts"; import { useNavigate, useOutlet } from "react-router"; import { createContext, useContext, useEffect, useState } from "react"; -import { MdOutlinePerson, MdSearch, MdSettings } from "react-icons/md"; +import {MdArrowUpward, MdOutlinePerson, MdSearch, MdSettings} from "react-icons/md"; import { useTranslation } from "react-i18next"; import UploadingSideBar from "./uploading_side_bar.tsx"; import { IoLogoGithub } from "react-icons/io"; @@ -26,6 +26,7 @@ export default function Navigator() { const { t } = useTranslation(); return <> +
@@ -270,3 +271,29 @@ function SearchBar() { return searchField } + +function FloatingToTopButton() { + const [visible, setVisible] = useState(false); + + useEffect(() => { + const handleScroll = () => { + if (window.scrollY > 200) { + setVisible(true); + } else { + setVisible(false); + } + }; + + window.addEventListener("scroll", handleScroll); + + return () => { + window.removeEventListener("scroll", handleScroll); + }; + }, []); + + return ; +}