"use client"; import { useEffect, useRef } from "react"; import { useTheme } from "@/lib/theme"; export default function DragonEye({ size = 60 }: { size?: number }) { const irisRef = useRef(null); const { theme } = useTheme(); const isLight = theme === "light"; useEffect(() => { const handleMouseMove = (e: MouseEvent) => { if (!irisRef.current) return; const rect = irisRef.current.parentElement!.getBoundingClientRect(); const cx = rect.left + rect.width / 2; const cy = rect.top + rect.height / 2; const dx = e.clientX - cx; const dy = e.clientY - cy; const dist = Math.sqrt(dx * dx + dy * dy); const max = 5; const mx = (dx / Math.max(dist, 1)) * Math.min(dist * 0.1, max); const my = (dy / Math.max(dist, 1)) * Math.min(dist * 0.1, max); irisRef.current.style.transform = `translate(calc(-50% + ${mx}px), calc(-50% + ${my}px))`; }; window.addEventListener("mousemove", handleMouseMove); return () => window.removeEventListener("mousemove", handleMouseMove); }, []); const h = size; const w = size * 1.6; // Light theme: sky-blue palette const glowColor = isLight ? "#38bdf8" : "#4aff8c"; const eyeBg = isLight ? "radial-gradient(ellipse at 40% 35%, #e0f7ff, #b8eeff)" : "radial-gradient(ellipse at 40% 35%, #0a1a0a, #020402)"; const eyeBorder = isLight ? "rgba(56,189,248,0.4)" : "rgba(74,255,140,0.25)"; const eyeShadow = isLight ? "0 0 20px rgba(56,189,248,0.25), inset 0 0 10px rgba(56,189,248,0.1)" : "0 0 20px rgba(74,255,140,0.1), inset 0 0 20px rgba(0,0,0,0.8)"; const irisBg = isLight ? "radial-gradient(ellipse at 40% 35%, #7dd3fc 0%, #0ea5e9 35%, #0369a1 70%)" : "radial-gradient(ellipse at 40% 35%, #1aff6a 0%, #0a8a3a 35%, #022a12 70%)"; const irisShadow = isLight ? "0 0 12px rgba(56,189,248,0.6)" : "0 0 12px rgba(74,255,140,0.4)"; const pupilBg = isLight ? "#001a2e" : "#010801"; const eyelidBg = isLight ? "#dbeafe" : "#0a0d0f"; return (
{/* Outer glow */}
{/* Eye shape */}
{/* Iris */}
{/* Pupil */}
{/* Highlight */}
{/* Eyelid top */}
{/* Eyelid bottom */}
); }