refactor: consolidate navigation links into reusable NavLinks component with dynamic styling
This commit is contained in:
@@ -3,8 +3,9 @@
|
||||
import { useRef, useState } from 'react'
|
||||
import Link from 'next/link'
|
||||
import { AnimatePresence, motion } from 'framer-motion'
|
||||
import clsx from 'clsx'
|
||||
|
||||
export function NavLinks() {
|
||||
export function NavLinks({ className }: { className?: string }) {
|
||||
let [hoveredIndex, setHoveredIndex] = useState<number | null>(null)
|
||||
let timeoutRef = useRef<number | null>(null)
|
||||
|
||||
@@ -31,7 +32,10 @@ export function NavLinks() {
|
||||
<Link
|
||||
key={label}
|
||||
href={href}
|
||||
className="relative -mx-3 -my-2 rounded-lg px-3 py-2 text-sm text-white transition-colors delay-150 hover:text-gray-300 hover:delay-0"
|
||||
className={clsx(
|
||||
'relative -mx-3 -my-2 rounded-lg px-3 py-2 text-sm text-white transition-colors delay-150 hover:text-gray-300 hover:delay-0',
|
||||
className,
|
||||
)}
|
||||
onClick={(e) => handleClick(e, href)}
|
||||
onMouseEnter={() => {
|
||||
if (timeoutRef.current) {
|
||||
|
||||
Reference in New Issue
Block a user