|
1 | 1 | import { Link } from "react-router-dom"; |
2 | | -import { ShoppingBag, Search, User, Globe } from "lucide-react"; |
| 2 | +import { Globe, User } from "lucide-react"; |
3 | 3 | import { useLanguage } from "@/contexts/LanguageContext"; |
4 | 4 | import { useCartStore } from "@/stores/cartStore"; |
| 5 | +import { useState, useEffect } from "react"; |
| 6 | +import { cn } from "@/lib/utils"; |
| 7 | +import asperLogo from "@/assets/asper-lotus-logo.png"; |
| 8 | +import BrandIcon from "@/components/brand/BrandIcon"; |
| 9 | +import SearchBar from "@/components/home/SearchBar"; |
| 10 | +import AuthButton from "@/components/AuthButton"; |
5 | 11 |
|
6 | 12 | export const Header = () => { |
7 | | - const { locale, toggle, t } = useLanguage(); |
| 13 | + const { locale, toggle, t, dir } = useLanguage(); |
8 | 14 | const itemCount = useCartStore(s => s.items.reduce((sum, i) => sum + i.quantity, 0)); |
| 15 | + const [scrolled, setScrolled] = useState(false); |
| 16 | + |
| 17 | + useEffect(() => { |
| 18 | + const onScroll = () => setScrolled(window.scrollY > 60); |
| 19 | + window.addEventListener("scroll", onScroll, { passive: true }); |
| 20 | + return () => window.removeEventListener("scroll", onScroll); |
| 21 | + }, []); |
9 | 22 |
|
10 | 23 | return ( |
11 | | - <header className="fixed top-0 inset-x-0 z-50 bg-background/90 backdrop-blur-md border-b border-border"> |
12 | | - <div className="container mx-auto px-4 max-w-7xl flex items-center justify-between h-16"> |
13 | | - <Link to="/" className="font-serif text-xl font-bold text-primary tracking-wide"> |
14 | | - ASPER |
15 | | - </Link> |
16 | | - <nav className="hidden md:flex items-center gap-6 text-sm font-medium"> |
17 | | - <Link to="/shop" className="text-foreground/80 hover:text-primary transition-colors">{t("nav.shop")}</Link> |
18 | | - <Link to="/lab" className="text-foreground/80 hover:text-primary transition-colors">{t("nav.intelligence")}</Link> |
19 | | - </nav> |
20 | | - <div className="flex items-center gap-3"> |
21 | | - <button onClick={toggle} className="p-2 text-foreground/60 hover:text-accent transition-colors" aria-label="Toggle language"> |
22 | | - <Globe className="w-5 h-5" /> |
23 | | - </button> |
24 | | - <Link to="/auth" className="p-2 text-foreground/60 hover:text-primary transition-colors"> |
25 | | - <User className="w-5 h-5" /> |
26 | | - </Link> |
27 | | - <Link to="/shop" className="p-2 text-foreground/60 hover:text-primary transition-colors relative"> |
28 | | - <ShoppingBag className="w-5 h-5" /> |
29 | | - {itemCount > 0 && ( |
30 | | - <span className="absolute -top-0.5 -right-0.5 bg-primary text-primary-foreground text-[10px] w-4 h-4 rounded-full flex items-center justify-center font-bold"> |
31 | | - {itemCount} |
32 | | - </span> |
33 | | - )} |
| 24 | + <header className="fixed top-0 inset-x-0 z-50 border-b border-accent/10 glass-nav"> |
| 25 | + <div className="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8"> |
| 26 | + <div className="flex h-16 items-center justify-between"> |
| 27 | + {/* Logo with scroll shrink */} |
| 28 | + <Link to="/" className="flex items-center gap-2"> |
| 29 | + <img |
| 30 | + src={asperLogo} |
| 31 | + alt="Asper" |
| 32 | + className={cn( |
| 33 | + "w-auto transition-all duration-500 ease-luxury", |
| 34 | + scrolled ? "h-6" : "h-8" |
| 35 | + )} |
| 36 | + /> |
| 37 | + <span |
| 38 | + className={cn( |
| 39 | + "text-xs font-body uppercase tracking-[0.25em] text-muted-foreground mt-1 transition-all duration-500", |
| 40 | + scrolled ? "opacity-0 w-0 overflow-hidden" : "opacity-100" |
| 41 | + )} |
| 42 | + > |
| 43 | + Beauty Shop |
| 44 | + </span> |
34 | 45 | </Link> |
| 46 | + |
| 47 | + {/* Desktop Navigation */} |
| 48 | + <nav className="hidden md:flex items-center gap-8"> |
| 49 | + <Link to="/shop" className="text-sm font-medium text-foreground/80 hover:text-primary transition-colors font-body"> |
| 50 | + {t("nav.shop")} |
| 51 | + </Link> |
| 52 | + <Link to="/products" className="text-sm font-medium text-foreground/80 hover:text-primary transition-colors font-body"> |
| 53 | + Products |
| 54 | + </Link> |
| 55 | + <Link to="/intelligence" className="text-sm font-medium text-foreground/80 hover:text-primary transition-colors font-body"> |
| 56 | + {t("nav.intelligence")} |
| 57 | + </Link> |
| 58 | + </nav> |
| 59 | + |
| 60 | + {/* Actions */} |
| 61 | + <div className="flex items-center gap-1"> |
| 62 | + <BrandIcon icon="globe" onClick={toggle} ariaLabel="Switch language" /> |
| 63 | + <SearchBar /> |
| 64 | + <BrandIcon |
| 65 | + icon="cart" |
| 66 | + notificationCount={itemCount} |
| 67 | + onClick={() => {}} |
| 68 | + ariaLabel="Open cart" |
| 69 | + /> |
| 70 | + <AuthButton /> |
| 71 | + </div> |
35 | 72 | </div> |
36 | 73 | </div> |
37 | 74 | </header> |
|
0 commit comments