From 2711ccc156c41075e853e6176022a58d51c6f911 Mon Sep 17 00:00:00 2001 From: hongggy Date: Sat, 16 Nov 2024 14:58:58 +0900 Subject: [PATCH 1/6] =?UTF-8?q?Feat:=20=EB=A7=A8=EC=9C=84=EB=B2=84?= =?UTF-8?q?=ED=8A=BC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/toTopBtn/ToTopBtn.tsx | 13 +++++++++++++ pages/link/index.tsx | 2 ++ 2 files changed, 15 insertions(+) create mode 100644 components/toTopBtn/ToTopBtn.tsx diff --git a/components/toTopBtn/ToTopBtn.tsx b/components/toTopBtn/ToTopBtn.tsx new file mode 100644 index 0000000..5ff6275 --- /dev/null +++ b/components/toTopBtn/ToTopBtn.tsx @@ -0,0 +1,13 @@ +import { FaAngleUp } from "react-icons/fa6"; + +const ToTopBtn = () => { + const handleClickToTop = () => { + window.scrollTo({ top: 0 }); + }; + return ( + + ); +}; +export default ToTopBtn; diff --git a/pages/link/index.tsx b/pages/link/index.tsx index 8f18dd9..21c56b5 100644 --- a/pages/link/index.tsx +++ b/pages/link/index.tsx @@ -18,6 +18,7 @@ import FolderActionsMenu from "@/components/Folder/FolderActionsMenu"; import CardsLayout from "@/components/Layout/CardsLayout"; import LinkCard from "@/components/Link/LinkCard"; import fetchProxy from "@/lib/api/fetchProxy"; +import ToTopBtn from "@/components/toTopBtn/ToTopBtn"; interface LinkPageProps { linkList: LinkData[]; @@ -89,6 +90,7 @@ const LinkPage = ({ {isOpen && } + ); From cbf7e4c9036beabc900b8a7a6f2a2c887ccbec4f Mon Sep 17 00:00:00 2001 From: hongggy Date: Sat, 16 Nov 2024 14:58:58 +0900 Subject: [PATCH 2/6] =?UTF-8?q?Feat:=20=EB=A7=A8=EC=9C=84=EB=B2=84?= =?UTF-8?q?=ED=8A=BC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/toTopBtn/ToTopBtn.tsx | 13 +++++++++++++ pages/link/index.tsx | 2 ++ 2 files changed, 15 insertions(+) create mode 100644 components/toTopBtn/ToTopBtn.tsx diff --git a/components/toTopBtn/ToTopBtn.tsx b/components/toTopBtn/ToTopBtn.tsx new file mode 100644 index 0000000..5ff6275 --- /dev/null +++ b/components/toTopBtn/ToTopBtn.tsx @@ -0,0 +1,13 @@ +import { FaAngleUp } from "react-icons/fa6"; + +const ToTopBtn = () => { + const handleClickToTop = () => { + window.scrollTo({ top: 0 }); + }; + return ( + + ); +}; +export default ToTopBtn; diff --git a/pages/link/index.tsx b/pages/link/index.tsx index 8f18dd9..21c56b5 100644 --- a/pages/link/index.tsx +++ b/pages/link/index.tsx @@ -18,6 +18,7 @@ import FolderActionsMenu from "@/components/Folder/FolderActionsMenu"; import CardsLayout from "@/components/Layout/CardsLayout"; import LinkCard from "@/components/Link/LinkCard"; import fetchProxy from "@/lib/api/fetchProxy"; +import ToTopBtn from "@/components/toTopBtn/ToTopBtn"; interface LinkPageProps { linkList: LinkData[]; @@ -89,6 +90,7 @@ const LinkPage = ({ {isOpen && } + ); From 5a9e735d88cf1d2956882dca7cdb71897c7d44dc Mon Sep 17 00:00:00 2001 From: hongggy Date: Sat, 16 Nov 2024 15:40:45 +0900 Subject: [PATCH 3/6] =?UTF-8?q?Feat:=20=EB=B2=84=ED=8A=BC=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/Layout/Container.tsx | 20 +++++++++++++++++++- components/toTopBtn/ToTopBtn.tsx | 13 ++++++++++--- pages/link/index.tsx | 4 +--- 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/components/Layout/Container.tsx b/components/Layout/Container.tsx index 15a8897..f4cdb0c 100644 --- a/components/Layout/Container.tsx +++ b/components/Layout/Container.tsx @@ -1,13 +1,31 @@ -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/toTopBtn/ToTopBtn.tsx b/components/toTopBtn/ToTopBtn.tsx index 5ff6275..667c4de 100644 --- a/components/toTopBtn/ToTopBtn.tsx +++ b/components/toTopBtn/ToTopBtn.tsx @@ -4,10 +4,17 @@ const ToTopBtn = () => { const handleClickToTop = () => { window.scrollTo({ top: 0 }); }; + return ( - + <> + + ); }; export default ToTopBtn; diff --git a/pages/link/index.tsx b/pages/link/index.tsx index 21c56b5..7d9318e 100644 --- a/pages/link/index.tsx +++ b/pages/link/index.tsx @@ -18,7 +18,6 @@ import FolderActionsMenu from "@/components/Folder/FolderActionsMenu"; import CardsLayout from "@/components/Layout/CardsLayout"; import LinkCard from "@/components/Link/LinkCard"; import fetchProxy from "@/lib/api/fetchProxy"; -import ToTopBtn from "@/components/toTopBtn/ToTopBtn"; interface LinkPageProps { linkList: LinkData[]; @@ -70,7 +69,7 @@ const LinkPage = ({
-
+
{search && } @@ -90,7 +89,6 @@ const LinkPage = ({ {isOpen && } -
); From f6725d02a8d07b3564743044fe86b7d2e0ba45b2 Mon Sep 17 00:00:00 2001 From: hongggy Date: Sat, 16 Nov 2024 15:42:41 +0900 Subject: [PATCH 4/6] =?UTF-8?q?Chore:=20=EC=9C=84=EC=B9=98=20=EC=A1=B0?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/toTopBtn/ToTopBtn.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/toTopBtn/ToTopBtn.tsx b/components/toTopBtn/ToTopBtn.tsx index 667c4de..a2b1d4b 100644 --- a/components/toTopBtn/ToTopBtn.tsx +++ b/components/toTopBtn/ToTopBtn.tsx @@ -10,7 +10,7 @@ const ToTopBtn = () => { From 8a23807ee5087a805762570cb1a6d6d50822266b Mon Sep 17 00:00:00 2001 From: hongggy Date: Sat, 16 Nov 2024 15:54:35 +0900 Subject: [PATCH 5/6] =?UTF-8?q?Chore:=20=EB=AA=A8=EB=8B=AC=20=EC=9D=BC?= =?UTF-8?q?=EB=B6=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/modal/AddFolderModal.tsx | 2 +- components/modal/SNSModal.tsx | 4 ++-- components/modal/modalManager/ModalManager.tsx | 6 +++++- 3 files changed, 8 insertions(+), 4 deletions(-) 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 ( Date: Sat, 16 Nov 2024 16:28:49 +0900 Subject: [PATCH 6/6] =?UTF-8?q?Fix:=20link=20page=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=EB=B2=84=ED=8A=BC=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/Layout/Container.tsx | 1 + pages/link/index.tsx | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/components/Layout/Container.tsx b/components/Layout/Container.tsx index f4cdb0c..e28c392 100644 --- a/components/Layout/Container.tsx +++ b/components/Layout/Container.tsx @@ -22,6 +22,7 @@ const Container = ({ children }: ContainerProps) => { window.removeEventListener("scroll", handleScroll); }; }, []); + return (
{children} diff --git a/pages/link/index.tsx b/pages/link/index.tsx index 75ceb1b..2d38029 100644 --- a/pages/link/index.tsx +++ b/pages/link/index.tsx @@ -18,7 +18,6 @@ import FolderActionsMenu from "@/components/Folder/FolderActionsMenu"; import CardsLayout from "@/components/Layout/CardsLayout"; import LinkCard from "@/components/Link/LinkCard"; import fetchProxy from "@/lib/api/fetchProxy"; -import ToTopBtn from "@/components/toTopBtn/ToTopBtn"; interface LinkPageProps { linkList: LinkData[]; @@ -90,7 +89,6 @@ const LinkPage = ({ {isOpen && } -
);