diff --git a/components/Layout/Container.tsx b/components/Layout/Container.tsx index 15a8897..e28c392 100644 --- a/components/Layout/Container.tsx +++ b/components/Layout/Container.tsx @@ -1,13 +1,32 @@ -import React from "react"; +import React, { useEffect, useState } from "react"; +import ToTopBtn from "@/components/toTopBtn/ToTopBtn"; interface ContainerProps { children: React.ReactNode; } const Container = ({ children }: ContainerProps) => { + const [showBtn, setShowBtn] = useState(false); + + useEffect(() => { + const handleScroll = () => { + if (window.scrollY > 300) { + setShowBtn(true); + } else { + setShowBtn(false); + } + }; + window.addEventListener("scroll", handleScroll); + + return () => { + window.removeEventListener("scroll", handleScroll); + }; + }, []); + return (
{children} + {showBtn && }
); }; diff --git a/components/modal/AddFolderModal.tsx b/components/modal/AddFolderModal.tsx index cbeecfb..1a55dc4 100644 --- a/components/modal/AddFolderModal.tsx +++ b/components/modal/AddFolderModal.tsx @@ -37,7 +37,7 @@ const AddFolderModal = ({ folderName }: { folderName: string }) => { return ( { +const SNSModal = () => { return ( - + ); diff --git a/components/modal/modalManager/ModalManager.tsx b/components/modal/modalManager/ModalManager.tsx index a24ae0f..f46adf2 100644 --- a/components/modal/modalManager/ModalManager.tsx +++ b/components/modal/modalManager/ModalManager.tsx @@ -52,7 +52,11 @@ export const Modal = () => { /> ); case "SNSModal": - return ; + return ( + + ); case "EditLink": return ( { + const handleClickToTop = () => { + window.scrollTo({ top: 0 }); + }; + + return ( + <> + + + ); +}; +export default ToTopBtn; diff --git a/pages/link/index.tsx b/pages/link/index.tsx index f32e911..2d38029 100644 --- a/pages/link/index.tsx +++ b/pages/link/index.tsx @@ -69,7 +69,7 @@ const LinkPage = ({
-
+
{search && }