From 50a0f0240d7fef133eb5acc1bea2b1168b08e9db Mon Sep 17 00:00:00 2001 From: Factiven Date: Sun, 24 Dec 2023 13:03:54 +0700 Subject: migrate to typescript --- components/shared/NavBar.js | 267 -------------------------------------------- 1 file changed, 267 deletions(-) delete mode 100644 components/shared/NavBar.js (limited to 'components/shared/NavBar.js') diff --git a/components/shared/NavBar.js b/components/shared/NavBar.js deleted file mode 100644 index 8cfdfc1..0000000 --- a/components/shared/NavBar.js +++ /dev/null @@ -1,267 +0,0 @@ -import { useSearch } from "@/lib/context/isOpenState"; -import { getCurrentSeason } from "@/utils/getTimes"; -import { ArrowLeftIcon, ArrowUpCircleIcon } from "@heroicons/react/20/solid"; -import { UserIcon } from "@heroicons/react/24/solid"; -import { signIn, signOut, useSession } from "next-auth/react"; -import Image from "next/image"; -import Link from "next/link"; -import { useRouter } from "next/router"; -import { useEffect, useState } from "react"; - -const getScrollPosition = (el = window) => ({ - x: el.pageXOffset !== undefined ? el.pageXOffset : el.scrollLeft, - y: el.pageYOffset !== undefined ? el.pageYOffset : el.scrollTop, -}); - -export function NewNavbar({ - info, - scrollP = 200, - toTop = false, - withNav = false, - paddingY = "py-3", - home = false, - back = false, - manga = false, - shrink = false, -}) { - const { data: session } = useSession(); - const router = useRouter(); - const [scrollPosition, setScrollPosition] = useState(); - const { setIsOpen } = useSearch(); - - const year = new Date().getFullYear(); - const season = getCurrentSeason(); - - useEffect(() => { - const handleScroll = () => { - setScrollPosition(getScrollPosition()); - }; - - // Add a scroll event listener when the component mounts - window.addEventListener("scroll", handleScroll); - - // Clean up the event listener when the component unmounts - return () => { - window.removeEventListener("scroll", handleScroll); - }; - }, []); - return ( - <> - - {toTop && ( - - )} - - ); -} -- cgit v1.2.3