From 88aea9d7faba08cf4b7f1c8061adce7ced208d34 Mon Sep 17 00:00:00 2001 From: Julian Date: Tue, 17 Sep 2024 12:26:21 +0200 Subject: [PATCH] Scrolldown icon is clickable --- src/components/home/ScrollDownIcon.tsx | 10 ++++++++-- src/pages/home.tsx | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/components/home/ScrollDownIcon.tsx b/src/components/home/ScrollDownIcon.tsx index 1239877..6fe93e4 100644 --- a/src/components/home/ScrollDownIcon.tsx +++ b/src/components/home/ScrollDownIcon.tsx @@ -20,14 +20,20 @@ const ScrollDownIcon = () => { }; }, []); // Tom dependency array betyr at effekten kjøres ved mount og cleanup ved unmount + const handleClick = (targetId: string) => { + const targetElement = document.getElementById(targetId); + targetElement?.scrollIntoView({ behavior: "smooth" }); + }; + return (
handleClick('home-text')} > - +
); }; diff --git a/src/pages/home.tsx b/src/pages/home.tsx index dfc46fc..a7c9a23 100644 --- a/src/pages/home.tsx +++ b/src/pages/home.tsx @@ -12,7 +12,7 @@ const HomePage = () => (

Online Fondet

-
{homeText}
+
{homeText}