"use client"; import clsx from "clsx"; import { ChevronLeft, ChevronRight, CircleUserRound, type LucideIcon, Menu, Phone, Search, Send, ShoppingBag, X, } from "lucide-react"; import { type CSSProperties, Fragment, useState } from "react"; import { Logo, LogoImage, LogoTextDesktop, } from "@/components/shadcnblocks/logo"; import { AspectRatio } from "@/components/ui/aspect-ratio"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { NavigationMenu, NavigationMenuContent, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, } from "@/components/ui/navigation-menu"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@/components/ui/select"; import { Sheet, SheetClose, SheetContent, SheetFooter, SheetHeader, SheetTitle, } from "@/components/ui/sheet"; import { useIsMobile } from "@/hooks/use-mobile"; import usePreventScrollLock from "@/hooks/usePreventScrollLock"; import { cn } from "@/lib/utils"; type MegaMenuSectionType = { label: string; href: string; id: string; imageSrc: string; items: { label: string; href: string; }[]; }; type FeaturedItemType = { imageSrc: string; href: string; label: string; }; type MenuItemType = { label: string; href?: string; accentColor?: string; id?: string; megaMenu?: { sections?: MegaMenuSectionType[]; featuredItems?: FeaturedItemType[]; }; }; type SocialIcon = { title: string; light: string; dark: string; }; type SocialLink = { href: string; icon: SocialIcon; }; type HelpfullLink = { href: string; label: string; }; type ContactInfoItem = { href: string; label: string; icon: LucideIcon; }; type HomeLink = { href: string; logo: { src: string; alt: string; }; }; type MenuItemProps = MenuItemType; interface EcommerceNavbar1Props { menu: MenuItemType[]; socialLinks?: SocialLink[]; helpfulLinks?: HelpfullLink[]; contactInfo?: ContactInfoItem[]; home: HomeLink; className?: string; } interface MenuLinksListProps { lists?: MegaMenuSectionType[]; } interface MenuFeaturedLinksProps { lists?: FeaturedItemType[]; } interface MenuLinksProps { list: MegaMenuSectionType; } interface MobileNavProps { menu: MenuItemType[]; socialLinks?: SocialLink[]; helpfulLinks?: HelpfullLink[]; contactInfo?: ContactInfoItem[]; } type MenuFeaturedLinkProps = FeaturedItemType; interface MegaMenuMobileProps { menuItem?: MenuItemType; open: boolean; onOpenChange: (open: boolean) => void; openSubMenu: boolean; handleOnSubMenuClick: (id?: string) => void; linkStyle?: string; closeAll: () => void; } interface SubMenuMobileProps { subMenu?: MegaMenuSectionType; open: boolean; onOpenChange: (open: boolean) => void; linkStyle?: string; closeAll: () => void; } interface SocialMediaSectionProps { links?: SocialLink[]; } interface HelpfullLinksProps { links?: HelpfullLink[]; } interface ContactInfoListProps { links?: ContactInfoItem[]; } const HELPFULL_LINKS = [ { label: "مرجوعی و تعویض", href: "#", }, { label: "ارسال و پیگیری", href: "#", }, { label: "شرایط و ضوابط", href: "#", }, ]; const CONTACT_INFO = [ { label: "+1 855-987-4420", href: "tel:+18559874420", icon: Phone, }, { label: "support@fashion.co", href: "mailto:support@fashion.co", icon: Send, }, ]; const SOCIAL_ICONS = { facebook: { title: "Facebook", light: "/block-media/shadcnblocks/block/logos/facebook-icon.svg", dark: "/block-media/shadcnblocks/block/logos/facebook-icon.svg", }, x: { title: "X", light: "/block-media/shadcnblocks/block/logos/x.svg", dark: "/block-media/shadcnblocks/block/logos/x.svg", }, instagram: { title: "Instagram", light: "/block-media/shadcnblocks/block/logos/instagram-icon.svg", dark: "/block-media/shadcnblocks/block/logos/instagram-icon.svg", }, } as const; const SOCIAL_MEDIA_LINKS = [ { icon: SOCIAL_ICONS.facebook, href: "#" }, { icon: SOCIAL_ICONS.x, href: "#" }, { icon: SOCIAL_ICONS.instagram, href: "#" }, ]; const MENU = [ { id: "store", label: "فروشگاه", href: "#", megaMenu: { sections: [ { label: "اکسسوری", href: "#", id: "accessories", imageSrc: "/block-media/shadcnblocks/block/ecommerce/accessories/Elegant-Watch-on-Womans-Wrist-2.png", items: [ { label: "کیف و کوله", href: "#" }, { label: "کلاه", href: "#" }, { label: "کمربند", href: "#" }, { label: "جواهرات", href: "#" }, { label: "عینک آفتابی", href: "#" }, { label: "ساعت", href: "#" }, ], }, { label: "مردانه", href: "#", id: "men", imageSrc: "/block-media/shadcnblocks/block/ecommerce/clothes/pexels-cottonbro-6764036-2.jpg", items: [ { label: "تازهها", href: "#" }, { label: "تیشرت", href: "#" }, { label: "پیراهن", href: "#" }, { label: "کت و کاپشن", href: "#" }, { label: "شلوار", href: "#" }, { label: "کفش", href: "#" }, ], }, { label: "زنانه", href: "#", id: "women", imageSrc: "/block-media/shadcnblocks/block/ecommerce/clothes/pexels-429124762-19881454-2.jpg", items: [ { label: "تازهها", href: "#" }, { label: "لباس", href: "#" }, { label: "تاپ و بلوز", href: "#" }, { label: "پوشاک بیرونی", href: "#" }, { label: "دامن", href: "#" }, { label: "کفش", href: "#" }, ], }, ], featuredItems: [ { imageSrc: "/block-media/shadcnblocks/block/ecommerce/clothes/Summer-Fashion-Duo-2.png", href: "#", label: "پیشنهاد تابستانه", }, { imageSrc: "/block-media/shadcnblocks/block/ecommerce/clothes/Contemplative-Casual-Chic-2.png", href: "#", label: "پرفروشترینها", }, ], }, }, { id: "collections", label: "مجموعهها", href: "#", megaMenu: { sections: [ { label: "بر اساس سبک", href: "#", id: "by-style", imageSrc: "/block-media/shadcnblocks/block/ecommerce/clothes/Man-in-White-Hoodie-1.png", items: [ { label: "مینیمال", href: "#" }, { label: "کلاسیک", href: "#" }, { label: "مدرن", href: "#" }, { label: "راحتی", href: "#" }, { label: "رسمی", href: "#" }, { label: "ورزشی", href: "#" }, ], }, { label: "بر اساس مناسبت", href: "#", id: "by-occasion", imageSrc: "/block-media/shadcnblocks/block/ecommerce/clothes/Chic-Fashion-Portrait-2.png", items: [ { label: "کار و اداری", href: "#" }, { label: "آخر هفته", href: "#" }, { label: "مهمانی", href: "#" }, { label: "سفر", href: "#" }, { label: "روزمره", href: "#" }, { label: "فصل جدید", href: "#" }, ], }, { label: "مجموعههای ویژه", href: "#", id: "curated", imageSrc: "/block-media/shadcnblocks/block/ecommerce/clothes/Modern-Fashion-Portrait-2.png", items: [ { label: "محصولات ضروری", href: "#" }, { label: "پرفروشترینها", href: "#" }, { label: "نسخه محدود", href: "#" }, { label: "ستهای آماده", href: "#" }, { label: "هدایای منتخب", href: "#" }, { label: "همکاریهای ویژه", href: "#" }, ], }, ], featuredItems: [ { imageSrc: "/block-media/shadcnblocks/block/ecommerce/clothes/Man-in-White-Hoodie-1.png", href: "#", label: "محصولات ضروری", }, { imageSrc: "/block-media/shadcnblocks/block/ecommerce/clothes/Man-in-White-Hoodie-1.png", href: "#", label: "کلاسیک مینیمال", }, { imageSrc: "/block-media/shadcnblocks/block/ecommerce/clothes/Man-in-White-Hoodie-1.png", href: "#", label: "لباس کار مدرن", }, { imageSrc: "/block-media/shadcnblocks/block/ecommerce/clothes/Man-in-White-Hoodie-1.png", href: "#", label: "لباس آخر هفته", }, ], }, }, { label: "حراج", href: "#", accentColor: "oklch(58.6% 0.253 17.585)", }, { label: "وبلاگ", href: "#", }, ]; const HOME = { href: "https://ShadcnBlocks", logo: { src: "/block-media/shadcnblocks/block/logos/ShadcnBlockscom-icon.svg", alt: "لوگو", }, }; const EcommerceNavbar1 = ({ menu = MENU, home = HOME, helpfulLinks = HELPFULL_LINKS, socialLinks = SOCIAL_MEDIA_LINKS, contactInfo = CONTACT_INFO, className, }: EcommerceNavbar1Props) => { const isMobile = useIsMobile(); return (