/* eslint-disable react-hooks/rules-of-hooks */ 'use client'; import React, { useRef, useState } from 'react'; import { motion, useMotionValue, useSpring, useTransform } from 'framer-motion'; import clsx from 'clsx'; import { twMerge } from 'tailwind-merge'; import Link from 'next/link'; const cn = (...args: any[]) => { return twMerge(clsx(args)); }; interface DockProps { className?: string; items?: { link?: string; Icon?: React.ReactNode; target?: string; defaultBgColor?: string; hoverBgColor?: string; tooltip?: string; // Optional tooltip text }[]; position?: 'left' | 'right' | 'top' | 'bottom'; } const Dock = ({ className = '', items = [], position = 'bottom' }: DockProps) => { let mouseX = useMotionValue(Infinity); let mouseY = useMotionValue(Infinity); const containerStyles = { left: 'left-0 ml-2 top-1/2 transform -translate-y-1/2', right: 'right-0 mr-2 top-1/2 transform -translate-y-1/2', top: 'top-0 mt-2 left-1/2 transform -translate-x-1/2', bottom: 'bottom-0 mb-2 left-1/2 transform -translate-x-1/2', }[position]; const dockLayout = position === 'top' || position === 'bottom' ? 'flex-row' : 'flex-col'; // Tooltip animation variants based on position const tooltipVariants = { top: { opacity: 1, y: 0 }, bottom: { opacity: 1, y: 0 }, left: { opacity: 1, x: 0 }, right: { opacity: 1, x: 0 }, }; const tooltipInitial = { top: { opacity: 0, y: -10 }, bottom: { opacity: 0, y: 10 }, left: { opacity: 0, x: -10 }, right: { opacity: 0, x: 10 }, }; const tooltipTransition = { duration: 0.3, ease: 'easeOut' }; return (