From 94846910bcb85f94d1c7c81d05e7df775cfa34c1 Mon Sep 17 00:00:00 2001 From: groninge Date: Tue, 24 Dec 2024 07:57:34 +0000 Subject: [PATCH] scroll to anchor --- .../app/(marketing)/risks/page.tsx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/apps/beets-frontend-v3/app/(marketing)/risks/page.tsx b/apps/beets-frontend-v3/app/(marketing)/risks/page.tsx index c5f6e190..9ee425ff 100644 --- a/apps/beets-frontend-v3/app/(marketing)/risks/page.tsx +++ b/apps/beets-frontend-v3/app/(marketing)/risks/page.tsx @@ -4,8 +4,23 @@ import Link from 'next/link' import { Container, Divider, Box } from '@chakra-ui/react' import { Prose } from '@nikolovlazar/chakra-ui-prose' import FadeInOnView from '@repo/lib/shared/components/containers/FadeInOnView' +import { useEffect } from 'react' export default function Privacy() { + useEffect(() => { + const handleHashChange = () => { + const { hash } = window.location + if (hash) { + const id = hash.substring(1) + const element = document.getElementById(id) + element?.scrollIntoView({ behavior: 'smooth' }) + } + } + + // Run on initial load + handleHashChange() + }, []) + return (