feat(ui): implement true liquid glass with high refraction, specular lens glare, chromatic caustics, and interactive cursor tracking
This commit is contained in:
@@ -15,6 +15,7 @@ interface NavbarProps {
|
||||
export function Navbar({ config, currentLocale }: NavbarProps) {
|
||||
const [isScrolled, setIsScrolled] = useState(false);
|
||||
const [mobileMenuOpen, setMobileMenuOpen] = useState(false);
|
||||
const [mousePos, setMousePos] = useState({ x: 50, y: 50, active: false });
|
||||
const pathname = usePathname();
|
||||
|
||||
useEffect(() => {
|
||||
@@ -25,18 +26,40 @@ export function Navbar({ config, currentLocale }: NavbarProps) {
|
||||
return () => window.removeEventListener('scroll', handleScroll);
|
||||
}, []);
|
||||
|
||||
const handleMouseMove = (e: React.MouseEvent<HTMLDivElement>) => {
|
||||
const rect = e.currentTarget.getBoundingClientRect();
|
||||
const x = ((e.clientX - rect.left) / rect.width) * 100;
|
||||
const y = ((e.clientY - rect.top) / rect.height) * 100;
|
||||
setMousePos({ x, y, active: true });
|
||||
};
|
||||
|
||||
const handleMouseLeave = () => {
|
||||
setMousePos((prev) => ({ ...prev, active: false }));
|
||||
};
|
||||
|
||||
return (
|
||||
<header className="fixed top-3 sm:top-5 left-0 right-0 z-50 px-3 sm:px-6 lg:px-8 pointer-events-none transition-all duration-300">
|
||||
<div
|
||||
className={`max-w-6xl mx-auto liquid-glass-nav rounded-2xl sm:rounded-[22px] px-3.5 sm:px-6 py-2.5 sm:py-3 flex items-center justify-between transition-all duration-300 pointer-events-auto ${
|
||||
onMouseMove={handleMouseMove}
|
||||
onMouseLeave={handleMouseLeave}
|
||||
className={`relative max-w-6xl mx-auto liquid-glass-nav rounded-2xl sm:rounded-[22px] px-3.5 sm:px-6 py-2.5 sm:py-3 flex items-center justify-between transition-all duration-300 pointer-events-auto ${
|
||||
isScrolled ? 'shadow-cream-lg' : 'shadow-cream-md'
|
||||
}`}
|
||||
>
|
||||
{/* Dynamic Specular Caustic Glint */}
|
||||
<div
|
||||
className="absolute inset-0 pointer-events-none transition-opacity duration-300 z-[2]"
|
||||
style={{
|
||||
opacity: mousePos.active ? 1 : 0.5,
|
||||
background: `radial-gradient(ellipse 320px 110px at ${mousePos.x}% ${mousePos.y}%, rgba(255, 255, 255, 0.75) 0%, rgba(255, 255, 255, 0.2) 40%, transparent 75%)`,
|
||||
}}
|
||||
/>
|
||||
|
||||
{/* Brand Logo */}
|
||||
<BrandLogo size="md" />
|
||||
|
||||
{/* Center Navigation Links - Floating Glass Track */}
|
||||
<nav className="hidden md:flex items-center gap-1 px-1.5 py-1 rounded-full bg-slate-900/[0.03] border border-white/70 shadow-inner">
|
||||
<nav className="hidden md:flex items-center gap-1 px-1.5 py-1 rounded-full bg-white/40 backdrop-blur-sm border border-white/80 shadow-inner">
|
||||
{config.nav.header.map((item) => {
|
||||
const active = pathname === item.href;
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user