|
|
@ -11,7 +11,7 @@ import OverLayer from "../OverLayer"; |
|
|
|
import cartIcon from "./cart-blue.svg"; |
|
|
|
import cartIcon from "./cart-blue.svg"; |
|
|
|
// import whiteCartIcon from "./white-cart-icon.svg";
|
|
|
|
// import whiteCartIcon from "./white-cart-icon.svg";
|
|
|
|
// import profileIcon from "./dark-crimson-profile-icon.svg";
|
|
|
|
// import profileIcon from "./dark-crimson-profile-icon.svg";
|
|
|
|
// import searchIcon from "./dark-crimson-search-box.svg";
|
|
|
|
import searchIcon from "./dark-crimson-search-box.svg"; |
|
|
|
// import lightGraySearchIcon from "./light-gray-search-box.svg";
|
|
|
|
// import lightGraySearchIcon from "./light-gray-search-box.svg";
|
|
|
|
import darkCrimsonHamburgerMenu from "./dark-crimson-hamburger-menu.svg"; |
|
|
|
import darkCrimsonHamburgerMenu from "./dark-crimson-hamburger-menu.svg"; |
|
|
|
// import whiteHamburgerMenu from "./white-hamburger-menu-icon.svg";
|
|
|
|
// import whiteHamburgerMenu from "./white-hamburger-menu-icon.svg";
|
|
|
@ -40,24 +40,14 @@ function Navbar({ |
|
|
|
isMobile, |
|
|
|
isMobile, |
|
|
|
isLogin, |
|
|
|
isLogin, |
|
|
|
headerOptions, |
|
|
|
headerOptions, |
|
|
|
loginBtn, |
|
|
|
|
|
|
|
menuItems, |
|
|
|
|
|
|
|
category, |
|
|
|
|
|
|
|
searchBox, |
|
|
|
|
|
|
|
topHeader, |
|
|
|
|
|
|
|
bottomHeader, |
|
|
|
|
|
|
|
productCategoryTextColor, |
|
|
|
|
|
|
|
menuItemsColor, |
|
|
|
|
|
|
|
}) { |
|
|
|
}) { |
|
|
|
const navigation = useNavigate(); |
|
|
|
const navigation = useNavigate(); |
|
|
|
const { logo, hamburgerMenu, qr, shown, menu, title, back, bookmark } = |
|
|
|
const { logo, hamburgerMenu, qr, shown, menu, title, back, bookmark } = |
|
|
|
headerOptions; |
|
|
|
headerOptions; |
|
|
|
|
|
|
|
const [overLayer, setOverLayer] = useState(false); |
|
|
|
const [top, setTop] = useState(false); |
|
|
|
const [top, setTop] = useState(false); |
|
|
|
const [search, setSearch] = useState(null); |
|
|
|
const [search, setSearch] = useState(null); |
|
|
|
const [drawerOpen, setDrawerOpen] = useState(false); |
|
|
|
const [drawerOpen, setDrawerOpen] = useState(false); |
|
|
|
const [desktopMiddleFix, setDesktopMiddleFix] = useState(false); |
|
|
|
|
|
|
|
const [desktopEndTransform, setDesktopEndTransform] = useState(false); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
if (window.scrollY === 0) { |
|
|
|
if (window.scrollY === 0) { |
|
|
@ -204,112 +194,78 @@ function Navbar({ |
|
|
|
{/* portrait end */} |
|
|
|
{/* portrait end */} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
) : ( |
|
|
|
) : ( |
|
|
|
<header className={`rounded-b-md w-full bg-transparent pb-1`}> |
|
|
|
<header |
|
|
|
<div className="flex flex-row justify-between items-center px-20 border-b border-gray-200 border-solid py-4 "> |
|
|
|
className={`rounded-b-md w-full border-b border-gray-200 border-solid fixed top-0 right-0 shadow-md bg-white z-20`} |
|
|
|
<div className="divide-x flex flex-row transform gap-4"> |
|
|
|
> |
|
|
|
{/* <span className="text-sm font-normal text-blue52"> |
|
|
|
<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"> |
|
|
|
</span> */} |
|
|
|
<div className="flex flex-row items-center"> |
|
|
|
<Link to="/orders" className="text-sm font-normal text-blue52"> |
|
|
|
<Link |
|
|
|
پیگیری سفارش |
|
|
|
to="/" |
|
|
|
</Link> |
|
|
|
className="flex flex-row items-center text-2xl font-medium" |
|
|
|
</div> |
|
|
|
> |
|
|
|
<div className="flex flex-row gap-5" style={{ direction: "ltr" }}> |
|
|
|
<img src={logoIcon} className="w-8 relative bottom-1 ml-1" /> |
|
|
|
{!isLogin && ( |
|
|
|
دانوین |
|
|
|
<Link to="/signup" className="text-sm font-semibold text-blue52"> |
|
|
|
|
|
|
|
ورود و ثبت نام |
|
|
|
|
|
|
|
</Link> |
|
|
|
|
|
|
|
)} |
|
|
|
|
|
|
|
<Link to="#" className="text-sm font-normal text-blue52"> |
|
|
|
|
|
|
|
شکایات |
|
|
|
|
|
|
|
</Link> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<div |
|
|
|
|
|
|
|
className={`w-full flex flex-col z-20 ${desktopMiddleFix ? "" : ""}`} |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<div className="w-full flex flex-row items-center h-full relative bg-white justify-between py-5 px-20 z-20 border-b border-gray-200 border-solid "> |
|
|
|
|
|
|
|
<div className="ml-10"> |
|
|
|
|
|
|
|
<Link to="/" className="flex flex-row items-center"> |
|
|
|
|
|
|
|
<img src={logoIcon} className="w-6" /> |
|
|
|
|
|
|
|
<span |
|
|
|
|
|
|
|
className={`font-bold text-3xl text-blue52 transform translate-y-1 mr-2`} |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
دانوین |
|
|
|
|
|
|
|
</span> |
|
|
|
|
|
|
|
</Link> |
|
|
|
</Link> |
|
|
|
|
|
|
|
<ul className="flex flex-row list-none items-center relative top-0.5 mr-6"> |
|
|
|
|
|
|
|
{pages.map((page, index) => ( |
|
|
|
|
|
|
|
<li key={index}> |
|
|
|
|
|
|
|
<Link |
|
|
|
|
|
|
|
to={page.link} |
|
|
|
|
|
|
|
className="text-tiny font-medium text-blue5F py-2 px-4 mx-4" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
{page.name} |
|
|
|
|
|
|
|
</Link> |
|
|
|
|
|
|
|
</li> |
|
|
|
|
|
|
|
))} |
|
|
|
|
|
|
|
</ul> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div |
|
|
|
{overLayer && ( |
|
|
|
className="hidden lg:flex items-center w-3/5 justify-around flex-1 absolute left-1/2 top-1/2 transform -translate-x-1/2 -translate-y-1/2" |
|
|
|
<div |
|
|
|
style={{ maxWidth: "calc(100vw / 2)" }} |
|
|
|
className="z-30 w-screen h-full fixed top-0 right-0 backdrop-filter blur-sm bg-opacity-60 bg-gray-600" |
|
|
|
></div> |
|
|
|
onClick={() => setOverLayer(false)} |
|
|
|
<OverLayer /> |
|
|
|
> |
|
|
|
<div |
|
|
|
<div className="relative w-full h-full"> |
|
|
|
className="flex flex-col w-full absolute left-1/2 top-1/2 transform -translate-x-1/2 -translate-y-1/2 z-50 rounded-md" |
|
|
|
<div |
|
|
|
style={{ maxWidth: "calc(100vw / 3)" }} |
|
|
|
className="flex flex-col w-full absolute left-1/2 top-8 transform -translate-x-1/2 z-50 rounded-md" |
|
|
|
> |
|
|
|
style={{ maxWidth: "calc(100vw / 3)" }} |
|
|
|
<Search onChange={(val) => setSearch(val)} /> |
|
|
|
onClick={(e) => e.stopPropagation()} |
|
|
|
{search && <SearchResult text={search} setText={setSearch} />} |
|
|
|
> |
|
|
|
</div> |
|
|
|
<Search onChange={(val) => setSearch(val)} /> |
|
|
|
{isLogin && ( |
|
|
|
{search && <SearchResult text={search} setText={setSearch} />} |
|
|
|
<div className="flex justify-end items-center gap-4"> |
|
|
|
</div> |
|
|
|
<Link to="/cart" className="relative"> |
|
|
|
</div> |
|
|
|
<img src={cartIcon} alt="" className="w-11" /> |
|
|
|
|
|
|
|
<span className="absolute -right-2 -top-0.5 w-6 h-6 flex justify-center items-center bg-blue-500 bg-opacity-90 rounded-full text-white text-tiny"> |
|
|
|
|
|
|
|
{cartProductsLength} |
|
|
|
|
|
|
|
</span> |
|
|
|
|
|
|
|
</Link> |
|
|
|
|
|
|
|
{/* <img src={whiteCartIcon} alt="" className="w-5 h-5 ml-2" /> */} |
|
|
|
|
|
|
|
{/* <img src={searchIcon} alt="" className="w-5 h-5 ml-2" /> */} |
|
|
|
|
|
|
|
{/* <img src={profileIcon} alt="" className="w-5 h-5" /> */} |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
)} |
|
|
|
)} |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div |
|
|
|
<div className="flex flex-row items-center"> |
|
|
|
className={`flex items-center relative w-full py-2 px-20 border-b border-solid border-gray-200 transform bg-white ${ |
|
|
|
|
|
|
|
desktopEndTransform ? "" : "" |
|
|
|
|
|
|
|
}`}
|
|
|
|
|
|
|
|
style={ |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// transition: "all 0.3s",
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<div className="ml-10 flex flex-row items-center"> |
|
|
|
|
|
|
|
<img |
|
|
|
<img |
|
|
|
src={darkCrimsonHamburgerMenu} |
|
|
|
src={searchIcon} |
|
|
|
alt="" |
|
|
|
alt="" |
|
|
|
className="w-8 transform translate-y-1 ml-2" |
|
|
|
className="w-7 ml-3 cursor-pointer" |
|
|
|
|
|
|
|
onClick={() => setOverLayer(true)} |
|
|
|
/> |
|
|
|
/> |
|
|
|
{/* <img src={whiteHamburgerMenu} alt="" className="w-3 h-3" /> */} |
|
|
|
{isLogin && ( |
|
|
|
<span className={`text-sm text-blue52 ${productCategoryTextColor}`}> |
|
|
|
<div className="flex justify-end items-center gap-4"> |
|
|
|
دسته بندی کالاها |
|
|
|
<Link to="/cart" className="relative"> |
|
|
|
</span> |
|
|
|
<img src={cartIcon} alt="" className="w-8" /> |
|
|
|
</div> |
|
|
|
<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"> |
|
|
|
<div |
|
|
|
{cartProductsLength} |
|
|
|
className="flex items-center justify-around w-3/5 absolute left-1/2 top-1/2 transform -translate-x-1/2 -translate-y-1/2" |
|
|
|
</span> |
|
|
|
style={{ maxWidth: "calc(100vw / 2)" }} |
|
|
|
</Link> |
|
|
|
> |
|
|
|
{/* <img src={whiteCartIcon} alt="" className="w-5 h-5 ml-2" /> */} |
|
|
|
{/* {menuItems.map((item, index) => ( |
|
|
|
|
|
|
|
<a |
|
|
|
|
|
|
|
href="#" |
|
|
|
|
|
|
|
className={`text-sm text-blue52 ${menuItemsColor}`} |
|
|
|
|
|
|
|
key={index} |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
{item} |
|
|
|
|
|
|
|
</a> |
|
|
|
|
|
|
|
))} */} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{pages.map((item, index) => ( |
|
|
|
{/* <img src={profileIcon} alt="" className="w-5 h-5" /> */} |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
)} |
|
|
|
|
|
|
|
{1 && ( |
|
|
|
<Link |
|
|
|
<Link |
|
|
|
to={item.link} |
|
|
|
to="/signup" |
|
|
|
className={`text-sm text-blue52 ${menuItemsColor} hover:text-blueC0`} |
|
|
|
className="bg-blueC0 text-white rounded-md px-4 py-3 text-sm mr-7 hover:bg-opacity-90 shadow-sm" |
|
|
|
key={"nav" + index} |
|
|
|
|
|
|
|
> |
|
|
|
> |
|
|
|
{item.name} |
|
|
|
ورود یا ثبت نام |
|
|
|
</Link> |
|
|
|
</Link> |
|
|
|
))} |
|
|
|
)} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -322,7 +278,9 @@ const mapStateToProps = (state) => ({ |
|
|
|
isMobile: state.publicApi.isMobile, |
|
|
|
isMobile: state.publicApi.isMobile, |
|
|
|
headerOptions: state.publicApi.headerOptions, |
|
|
|
headerOptions: state.publicApi.headerOptions, |
|
|
|
isLogin: state.user.status, |
|
|
|
isLogin: state.user.status, |
|
|
|
cartProductsLength: state.userProduct.list?.filter((product) => product.condition < 2)?.length, |
|
|
|
cartProductsLength: state.userProduct.list?.filter( |
|
|
|
|
|
|
|
(product) => product.condition < 2 |
|
|
|
|
|
|
|
)?.length, |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
const mapDispatchToProps = { |
|
|
|
const mapDispatchToProps = { |
|
|
@ -333,18 +291,10 @@ export default connect(mapStateToProps, mapDispatchToProps)(Navbar); |
|
|
|
|
|
|
|
|
|
|
|
Navbar.defaultProps = { |
|
|
|
Navbar.defaultProps = { |
|
|
|
pages: [ |
|
|
|
pages: [ |
|
|
|
{ |
|
|
|
|
|
|
|
link: "/", |
|
|
|
|
|
|
|
name: "خانه", |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
link: "/products", |
|
|
|
link: "/products", |
|
|
|
name: "محصولات", |
|
|
|
name: "محصولات", |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
|
|
|
|
link: "/filter", |
|
|
|
|
|
|
|
name: "دسته بندی ها", |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
link: "/contact-us", |
|
|
|
link: "/contact-us", |
|
|
|
name: "تماس با ما", |
|
|
|
name: "تماس با ما", |
|
|
|