33import Link from 'next/link'
44import { Menu , X } from 'lucide-react'
55import { Button } from '@/components/ui/button'
6+ import { scrollToHash } from '@/lib/scroll-to-hash'
67import React from 'react'
78import { cn } from '@/lib/utils'
89import { ConfidantLogo } from './confidant-logo'
@@ -31,13 +32,14 @@ export function ConfidantHeader() {
3132 < Link
3233 href = { item . href }
3334 { ...( item . external ? { target : '_blank' , rel : 'noopener noreferrer' } : { } ) }
35+ { ...( item . href . startsWith ( '#' ) ? { onClick : ( e ) => scrollToHash ( e , item . href ) } : { } ) }
3436 >
3537 { item . name }
3638 </ Link >
3739 </ Button >
3840 ) ) }
3941 < Button asChild size = "sm" className = "ml-2" >
40- < Link href = "#download" > Download</ Link >
42+ < Link href = "#download" onClick = { ( e ) => scrollToHash ( e , '#download' ) } > Download</ Link >
4143 </ Button >
4244 </ div >
4345 < button
@@ -55,12 +57,22 @@ export function ConfidantHeader() {
5557 key = { item . name }
5658 href = { item . href }
5759 { ...( item . external ? { target : '_blank' , rel : 'noopener noreferrer' } : { } ) }
58- onClick = { ( ) => setMenuState ( false ) }
60+ { ... ( item . href . startsWith ( '#' ) ? { onClick : ( e ) => { scrollToHash ( e , item . href ) ; setMenuState ( false ) } } : { onClick : ( ) => setMenuState ( false ) } ) }
5961 className = "block py-2 text-muted-foreground hover:text-foreground"
6062 >
6163 { item . name }
6264 </ Link >
6365 ) ) }
66+ < Link
67+ href = "#download"
68+ onClick = { ( e ) => {
69+ scrollToHash ( e , '#download' )
70+ setMenuState ( false )
71+ } }
72+ className = "block py-2 text-muted-foreground hover:text-foreground"
73+ >
74+ Download
75+ </ Link >
6476 </ div >
6577 ) }
6678 </ div >
0 commit comments