From 9c6ce91115e9511e303c57c169d31c2ba6b5af52 Mon Sep 17 00:00:00 2001 From: Florian Sommariva Date: Tue, 25 Jul 2023 12:05:47 +0200 Subject: [PATCH] Handle anchor links with next router --- src/components/map-menu.tsx | 19 ++++++++----------- src/components/observation-cta.tsx | 8 ++++---- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/components/map-menu.tsx b/src/components/map-menu.tsx index 6c98f69..7f719ba 100644 --- a/src/components/map-menu.tsx +++ b/src/components/map-menu.tsx @@ -1,5 +1,6 @@ 'use client'; +import Link from 'next/link'; import { usePathname } from 'next/navigation'; import { useTranslations } from 'next-intl'; @@ -8,7 +9,6 @@ import { cn } from '@/lib/utils'; export default function MapMenu() { const pathname = usePathname(); const t = useTranslations('mapMenu'); - //const hash = global.location?.hash ?? '#content'; const hasContent = pathname.startsWith('/map/'); const contentLabel = pathname.includes('observation') ? t('observation') @@ -22,39 +22,36 @@ export default function MapMenu() { )} >
  • - {t('search')} - +
  • {hasContent && (
  • - {contentLabel} - +
  • )}
  • - {t('map')} - +
  • diff --git a/src/components/observation-cta.tsx b/src/components/observation-cta.tsx index 9cfb609..bcdbf5a 100644 --- a/src/components/observation-cta.tsx +++ b/src/components/observation-cta.tsx @@ -32,25 +32,25 @@ export function ObservationCTA() { {t('damages.shortDescription')} {t('fauna-flora.shortDescription')} {t('quantity.shortDescription')} {t('quality.shortDescription')} {t('landscape.shortDescription')}