From 8fb69b0c73c897963531ea78d105792e573439a2 Mon Sep 17 00:00:00 2001 From: Kakabay <2kakabayashyrberdyew@gmail.com> Date: Sat, 9 Nov 2024 16:13:10 +0500 Subject: [PATCH] fix --- app/(main)/quiz/layout.tsx | 38 +++---------------------------- app/layout.tsx | 2 +- components/global/ScrollToTop.tsx | 10 +++++++- 3 files changed, 13 insertions(+), 37 deletions(-) diff --git a/app/(main)/quiz/layout.tsx b/app/(main)/quiz/layout.tsx index 36f4bcd..78f961f 100644 --- a/app/(main)/quiz/layout.tsx +++ b/app/(main)/quiz/layout.tsx @@ -1,45 +1,13 @@ -'use client'; import ScrollToTop from '@/components/global/ScrollToTop'; import useScrollToTop from '@/lib/hooks/useScrollToTop'; import { cn } from '@/lib/utils'; import { ChevronUp } from 'lucide-react'; -import React, { PropsWithChildren, useEffect, useState } from 'react'; +import React, { PropsWithChildren } from 'react'; const layout = ({ children }: PropsWithChildren) => { - const [clicked, setClicked] = useState(0); - - useEffect(() => { - window.scrollTo(0, 0); - console.log('first'); - }, [clicked]); - - const [scrollY, setScrollY] = useState(false); - - const handleScroll = () => { - setScrollY(window.scrollY > 500 ? true : false); - }; - - useEffect(() => { - window.addEventListener('scroll', handleScroll); - - return () => { - window.removeEventListener('scroll', handleScroll); - }; - }, []); - return ( -