|
|
|
@ -70,24 +70,52 @@ function Navbar({ |
|
|
|
|
} |
|
|
|
|
}, [isLogin]); |
|
|
|
|
|
|
|
|
|
return isMobile ? ( |
|
|
|
|
return ( |
|
|
|
|
<div |
|
|
|
|
className={_.join( |
|
|
|
|
[ |
|
|
|
|
"z-50 flex flex-1 flex-row fixed left-0 top-0 justify-between w-full lg:bg-opacity-20 lg:bg-transparent lg:shadow-sm lg:backdrop-filter lg:backdrop-blur-md lg:px-5 xl:px-10 transition-all duration-300", |
|
|
|
|
], |
|
|
|
|
" " |
|
|
|
|
)} |
|
|
|
|
className="z-50 flex fixed left-0 top-0 w-full" |
|
|
|
|
style={{ |
|
|
|
|
backgroundColor: !top ? (isDark ? "#061B30" : "white") : "", |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
{/* landscape start */} |
|
|
|
|
{/* landscape end */} |
|
|
|
|
{/* portrait start */} |
|
|
|
|
<div className="w-full lg:w-11/12 lg:mx-auto relative flex items-center justify-between py-3 px-4 bg-white"> |
|
|
|
|
{/* desktop */} |
|
|
|
|
<div className=" items-center hidden lg:flex"> |
|
|
|
|
<Link |
|
|
|
|
to="/" |
|
|
|
|
className="flex items-center text-2xl font-black text-green7B" |
|
|
|
|
> |
|
|
|
|
<img src={logoIcon} className="w-8 relative bottom-1 ml-1" alt="" /> |
|
|
|
|
{window.t("دانوین")} |
|
|
|
|
</Link> |
|
|
|
|
|
|
|
|
|
<div className="w-full h-full relative flex flex-row items-center justify-between lg:hidden py-3 px-4"> |
|
|
|
|
<div className="relative"> |
|
|
|
|
<ul className="flex list-none items-center relative top-0.5 mr-4"> |
|
|
|
|
{pages.map((page, index) => ( |
|
|
|
|
<li key={index}> |
|
|
|
|
<NavLink |
|
|
|
|
to={page.link} |
|
|
|
|
className="text-tiny py-2 px-4 mx-4" |
|
|
|
|
style={({ isActive }) => ({ |
|
|
|
|
color: isActive ? "rgb(19, 123, 79)" : "#202020", |
|
|
|
|
fontWeight: isActive ? "700" : "200", |
|
|
|
|
})} |
|
|
|
|
> |
|
|
|
|
{page.name} |
|
|
|
|
</NavLink> |
|
|
|
|
</li> |
|
|
|
|
))} |
|
|
|
|
</ul> |
|
|
|
|
</div> |
|
|
|
|
{logo && ( |
|
|
|
|
<Link |
|
|
|
|
to="/" |
|
|
|
|
className="lg:hidden absolute left-1/2 transform -translate-y-1/2 top-1/2 -translate-x-1/2" |
|
|
|
|
> |
|
|
|
|
<img src={logoIcon} className="w-6 h-8" /> |
|
|
|
|
</Link> |
|
|
|
|
)} |
|
|
|
|
{/* desktop */} |
|
|
|
|
{/* <div className="flex items-center"></div> */} |
|
|
|
|
<div className="flex lg:hidden relative"> |
|
|
|
|
{hamburgerMenu && ( |
|
|
|
|
<> |
|
|
|
|
<span className="w-2.5 h-2.5 rounded-full bg-redFF1 absolute -left-1 -top-1 animate-bounce"></span> |
|
|
|
@ -113,29 +141,31 @@ function Navbar({ |
|
|
|
|
</strong> |
|
|
|
|
)} |
|
|
|
|
</div> |
|
|
|
|
{logo && ( |
|
|
|
|
<Link |
|
|
|
|
to="/" |
|
|
|
|
className="absolute left-1/2 transform -translate-y-1/2 top-1/2 -translate-x-1/2" |
|
|
|
|
> |
|
|
|
|
<img src={logoIcon} className="w-6 h-8" /> |
|
|
|
|
</Link> |
|
|
|
|
)} |
|
|
|
|
|
|
|
|
|
<div className="flex flex-row items-center"> |
|
|
|
|
<div className="flex items-center"> |
|
|
|
|
{overLayer && ( |
|
|
|
|
<div |
|
|
|
|
className="z-30 w-screen h-full fixed top-0 right-0 backdrop-filter blur-sm bg-opacity-60 bg-gray-600" |
|
|
|
|
onClick={() => setOverLayer(false)} |
|
|
|
|
> |
|
|
|
|
<div className="relative w-full h-full"> |
|
|
|
|
<div |
|
|
|
|
className="flex flex-col w-full absolute left-1/2 top-16 transform -translate-x-1/2 z-50 rounded-md" |
|
|
|
|
style={{ maxWidth: "calc(100vw / 3)" }} |
|
|
|
|
onClick={(e) => e.stopPropagation()} |
|
|
|
|
> |
|
|
|
|
<Search onChange={(val) => setSearch(val)} /> |
|
|
|
|
{search && <SearchResult text={search} setText={setSearch} />} |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
)} |
|
|
|
|
{qr && ( |
|
|
|
|
<> |
|
|
|
|
<Link |
|
|
|
|
to="/scan" |
|
|
|
|
className={_.join( |
|
|
|
|
[ |
|
|
|
|
"rounded-sm p-1.5", |
|
|
|
|
isDark |
|
|
|
|
? "bg-blueC0 bg-opacity-10 ml-2" |
|
|
|
|
: " ml-3 shadow-sm", |
|
|
|
|
], |
|
|
|
|
" " |
|
|
|
|
)} |
|
|
|
|
className={`flex lg:hidden rounded-sm p-1.5 ${ |
|
|
|
|
isDark ? "bg-blueC0 bg-opacity-10 ml-2" : " ml-3 shadow-sm" |
|
|
|
|
}`}
|
|
|
|
|
style={{ |
|
|
|
|
border: `1px solid ${isDark ? "#D7E3FC20" : "#D7E3FC"}`, |
|
|
|
|
}} |
|
|
|
@ -148,13 +178,9 @@ function Navbar({ |
|
|
|
|
</Link> |
|
|
|
|
<Link |
|
|
|
|
to="/ar" |
|
|
|
|
className={_.join( |
|
|
|
|
[ |
|
|
|
|
"rounded-sm p-1.5", |
|
|
|
|
isDark ? "bg-blueC0 bg-opacity-10" : " shadow-sm", |
|
|
|
|
], |
|
|
|
|
" " |
|
|
|
|
)} |
|
|
|
|
className={`flex lg:hidden rounded-sm p-1.5 ${ |
|
|
|
|
isDark ? "bg-blueC0 bg-opacity-10" : "shadow-sm" |
|
|
|
|
}`}
|
|
|
|
|
style={{ |
|
|
|
|
border: `1px solid ${isDark ? "#D7E3FC20" : "#D7E3FC"}`, |
|
|
|
|
}} |
|
|
|
@ -173,7 +199,7 @@ function Navbar({ |
|
|
|
|
isDark ? bookmarkDeactiveDarkIcon : bookmarkDeactiveLightIcon |
|
|
|
|
} |
|
|
|
|
alt="bookmark" |
|
|
|
|
className="w-7" |
|
|
|
|
className="w-7 flex lg:hidden" |
|
|
|
|
onClick={() => addToFavorite({ [bookmark]: location.getId() })} |
|
|
|
|
/> |
|
|
|
|
)} |
|
|
|
@ -181,134 +207,76 @@ function Navbar({ |
|
|
|
|
<img |
|
|
|
|
src={isDark ? dotsMenuDarkIcon : dotsMenuLightIcon} |
|
|
|
|
alt="menu" |
|
|
|
|
className="w-7 mr-2" |
|
|
|
|
className="w-7 mr-2 flex lg:hidden" |
|
|
|
|
/> |
|
|
|
|
)} |
|
|
|
|
{title && back ? ( |
|
|
|
|
<img |
|
|
|
|
src={isDark ? arrowWhiteIcon : arrowBlueIcon} |
|
|
|
|
alt="back" |
|
|
|
|
className={`w-6 transform ${isDark ? "" : "-rotate-180"}`} |
|
|
|
|
className={`w-6 flex lg:hidden transform ${ |
|
|
|
|
isDark ? "" : "-rotate-180" |
|
|
|
|
}`}
|
|
|
|
|
onClick={() => navigation(-1)} |
|
|
|
|
/> |
|
|
|
|
) : null} |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
{/* desktop */} |
|
|
|
|
<select |
|
|
|
|
style={{ width: "100px" }} |
|
|
|
|
className="hidden lg:flex items-center text-blueC0 border border-blueC0 px-1 rounded base py-1.5 ml-4 cursor-pointer" |
|
|
|
|
> |
|
|
|
|
{language.map((item, index) => ( |
|
|
|
|
<option |
|
|
|
|
className="border border-blueC0 shadow-0 text-blueC0 text-base " |
|
|
|
|
key={index} |
|
|
|
|
> |
|
|
|
|
{item.name} |
|
|
|
|
</option> |
|
|
|
|
))} |
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
<Drawer drawerOpen={drawerOpen} setDrawerOpen={setDrawerOpen} /> |
|
|
|
|
{/* portrait end */} |
|
|
|
|
</div> |
|
|
|
|
) : ( |
|
|
|
|
<header |
|
|
|
|
className={`w-full border-b border-gray-200 border-solid fixed top-0 right-0 bg-white z-20`} |
|
|
|
|
style={{ boxShadow: "0px 0px 10px rgba(0,0,0,0.1)" }} |
|
|
|
|
> |
|
|
|
|
<div className={`w-11/12 mx-auto flex flex-col`}> |
|
|
|
|
<div className="w-full flex flex-row items-center py-3 relative justify-between h-ful"> |
|
|
|
|
<div className="flex flex-row items-center"> |
|
|
|
|
<Link |
|
|
|
|
to="/" |
|
|
|
|
className="flex flex-row items-center text-2xl font-black text-green7B" |
|
|
|
|
> |
|
|
|
|
<img |
|
|
|
|
src={logoIcon} |
|
|
|
|
className="w-8 relative bottom-1 ml-1" |
|
|
|
|
alt="" |
|
|
|
|
/> |
|
|
|
|
{window.t("دانوین")} |
|
|
|
|
</Link> |
|
|
|
|
<img |
|
|
|
|
src={searchIcon} |
|
|
|
|
alt="" |
|
|
|
|
className="w-7 ml-3 cursor-pointer lg:flex hidden" |
|
|
|
|
onClick={() => setOverLayer(true)} |
|
|
|
|
/> |
|
|
|
|
|
|
|
|
|
<ul className="flex flex-row list-none items-center relative top-0.5 mr-6"> |
|
|
|
|
{pages.map((page, index) => ( |
|
|
|
|
<li key={index}> |
|
|
|
|
<NavLink |
|
|
|
|
to={page.link} |
|
|
|
|
className="text-tiny py-2 px-4 mx-4" |
|
|
|
|
style={({ isActive }) => ({ |
|
|
|
|
color: isActive ? "rgb(19, 123, 79)" : "#202020", |
|
|
|
|
fontWeight: isActive ? "700" : "200", |
|
|
|
|
})} |
|
|
|
|
> |
|
|
|
|
{page.name} |
|
|
|
|
</NavLink> |
|
|
|
|
</li> |
|
|
|
|
))} |
|
|
|
|
</ul> |
|
|
|
|
</div> |
|
|
|
|
{isLogin && ( |
|
|
|
|
<div className="hidden lg:flex justify-end items-center gap-4"> |
|
|
|
|
<Link to="/cart" className="relative"> |
|
|
|
|
<img src={cartIcon} alt="" className="w-8" /> |
|
|
|
|
<span className="absolute -right-2 -top-0.5 w-4 p-2.5 h-4 flex justify-center items-center bg-green-700 bg-opacity-100 rounded-full text-white text-xs"> |
|
|
|
|
{cartProductsLength} |
|
|
|
|
</span> |
|
|
|
|
</Link> |
|
|
|
|
{/* <img src={whiteCartIcon} alt="" className="w-5 h-5 ml-2" /> */} |
|
|
|
|
|
|
|
|
|
{overLayer && ( |
|
|
|
|
<div |
|
|
|
|
className="z-30 w-screen h-full fixed top-0 right-0 backdrop-filter blur-sm bg-opacity-60 bg-gray-600" |
|
|
|
|
onClick={() => setOverLayer(false)} |
|
|
|
|
> |
|
|
|
|
<div className="relative w-full h-full"> |
|
|
|
|
<div |
|
|
|
|
className="flex flex-col w-full absolute left-1/2 top-16 transform -translate-x-1/2 z-50 rounded-md" |
|
|
|
|
style={{ maxWidth: "calc(100vw / 3)" }} |
|
|
|
|
onClick={(e) => e.stopPropagation()} |
|
|
|
|
> |
|
|
|
|
<Search onChange={(val) => setSearch(val)} /> |
|
|
|
|
{search && <SearchResult text={search} setText={setSearch} />} |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
{/* <img src={profileIcon} alt="" className="w-5 h-5" /> */} |
|
|
|
|
</div> |
|
|
|
|
)} |
|
|
|
|
|
|
|
|
|
<div className="flex flex-row items-center"> |
|
|
|
|
<select |
|
|
|
|
style={{ width: "100px" }} |
|
|
|
|
className="flex items-center text-blueC0 border border-blueC0 px-1 rounded base py-1.5 ml-4 cursor-pointer" |
|
|
|
|
{!isLogin ? ( |
|
|
|
|
<Link |
|
|
|
|
to="/signup" |
|
|
|
|
className="bg-blueC0 font-semibold text-white rounded-md px-4 py-3 text-sm mr-7 hover:bg-opacity-90 shadow-sm" |
|
|
|
|
> |
|
|
|
|
{language.map((item, index) => ( |
|
|
|
|
<option |
|
|
|
|
className="border border-blueC0 shadow-0 text-blueC0 text-base " |
|
|
|
|
key={index} |
|
|
|
|
> |
|
|
|
|
{item.name} |
|
|
|
|
</option> |
|
|
|
|
))} |
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
<img |
|
|
|
|
src={searchIcon} |
|
|
|
|
alt="" |
|
|
|
|
className="w-7 ml-3 cursor-pointer" |
|
|
|
|
onClick={() => setOverLayer(true)} |
|
|
|
|
/> |
|
|
|
|
|
|
|
|
|
{isLogin && ( |
|
|
|
|
<div className="flex justify-end items-center gap-4"> |
|
|
|
|
<Link to="/cart" className="relative"> |
|
|
|
|
<img src={cartIcon} alt="" className="w-8" /> |
|
|
|
|
<span className="absolute -right-2 -top-0.5 w-4 p-2.5 h-4 flex justify-center items-center bg-green-700 bg-opacity-100 rounded-full text-white text-xs"> |
|
|
|
|
{cartProductsLength} |
|
|
|
|
</span> |
|
|
|
|
</Link> |
|
|
|
|
{/* <img src={whiteCartIcon} alt="" className="w-5 h-5 ml-2" /> */} |
|
|
|
|
|
|
|
|
|
{/* <img src={profileIcon} alt="" className="w-5 h-5" /> */} |
|
|
|
|
</div> |
|
|
|
|
)} |
|
|
|
|
|
|
|
|
|
{!isLogin ? ( |
|
|
|
|
<Link |
|
|
|
|
to="/signup" |
|
|
|
|
className="bg-blueC0 font-semibold text-white rounded-md px-4 py-3 text-sm mr-7 hover:bg-opacity-90 shadow-sm" |
|
|
|
|
> |
|
|
|
|
{window.t("ورود یا ثبت نام")} |
|
|
|
|
</Link> |
|
|
|
|
) : ( |
|
|
|
|
<Link |
|
|
|
|
to="/dashboard" |
|
|
|
|
className="bg-blueC0 font-semibold text-white rounded-md px-4 py-3 text-sm mr-7 hover:bg-opacity-90 shadow-sm" |
|
|
|
|
> |
|
|
|
|
{window.t("حساب کاربری")} |
|
|
|
|
</Link> |
|
|
|
|
)} |
|
|
|
|
</div> |
|
|
|
|
{window.t("ورود یا ثبت نام")} |
|
|
|
|
</Link> |
|
|
|
|
) : ( |
|
|
|
|
<Link |
|
|
|
|
to="/dashboard" |
|
|
|
|
className="hidden lg:flex bg-blueC0 font-semibold text-white rounded-md px-4 py-3 text-sm mr-7 hover:bg-opacity-90 shadow-sm" |
|
|
|
|
> |
|
|
|
|
{window.t("حساب کاربری")} |
|
|
|
|
</Link> |
|
|
|
|
)} |
|
|
|
|
{/* desktop */} |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</header> |
|
|
|
|
|
|
|
|
|
<Drawer drawerOpen={drawerOpen} setDrawerOpen={setDrawerOpen} /> |
|
|
|
|
</div> |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|