|
|
@ -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"> |
|
|
|
|
|
|
|
انتخاب کشور |
|
|
|
|
|
|
|
</span> */} |
|
|
|
|
|
|
|
<Link to="/orders" className="text-sm font-normal text-blue52"> |
|
|
|
|
|
|
|
پیگیری سفارش |
|
|
|
|
|
|
|
</Link> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<div className="flex flex-row gap-5" style={{ direction: "ltr" }}> |
|
|
|
|
|
|
|
{!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={`w-11/12 mx-auto flex flex-col`}> |
|
|
|
<div className="ml-10"> |
|
|
|
<div className="w-full flex flex-row items-center py-3 relative justify-between h-ful"> |
|
|
|
<Link to="/" className="flex flex-row items-center"> |
|
|
|
<div className="flex flex-row items-center"> |
|
|
|
<img src={logoIcon} className="w-6" /> |
|
|
|
<Link |
|
|
|
<span |
|
|
|
to="/" |
|
|
|
className={`font-bold text-3xl text-blue52 transform translate-y-1 mr-2`} |
|
|
|
className="flex flex-row items-center text-2xl font-medium" |
|
|
|
> |
|
|
|
> |
|
|
|
|
|
|
|
<img src={logoIcon} className="w-8 relative bottom-1 ml-1" /> |
|
|
|
دانوین |
|
|
|
دانوین |
|
|
|
</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> |
|
|
|
|
|
|
|
{overLayer && ( |
|
|
|
<div |
|
|
|
<div |
|
|
|
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" |
|
|
|
className="z-30 w-screen h-full fixed top-0 right-0 backdrop-filter blur-sm bg-opacity-60 bg-gray-600" |
|
|
|
style={{ maxWidth: "calc(100vw / 2)" }} |
|
|
|
onClick={() => setOverLayer(false)} |
|
|
|
></div> |
|
|
|
> |
|
|
|
<OverLayer /> |
|
|
|
<div className="relative w-full h-full"> |
|
|
|
<div |
|
|
|
<div |
|
|
|
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" |
|
|
|
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)" }} |
|
|
|
style={{ maxWidth: "calc(100vw / 3)" }} |
|
|
|
|
|
|
|
onClick={(e) => e.stopPropagation()} |
|
|
|
> |
|
|
|
> |
|
|
|
<Search onChange={(val) => setSearch(val)} /> |
|
|
|
<Search onChange={(val) => setSearch(val)} /> |
|
|
|
{search && <SearchResult text={search} setText={setSearch} />} |
|
|
|
{search && <SearchResult text={search} setText={setSearch} />} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
)} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div className="flex flex-row items-center"> |
|
|
|
|
|
|
|
<img |
|
|
|
|
|
|
|
src={searchIcon} |
|
|
|
|
|
|
|
alt="" |
|
|
|
|
|
|
|
className="w-7 ml-3 cursor-pointer" |
|
|
|
|
|
|
|
onClick={() => setOverLayer(true)} |
|
|
|
|
|
|
|
/> |
|
|
|
{isLogin && ( |
|
|
|
{isLogin && ( |
|
|
|
<div className="flex justify-end items-center gap-4"> |
|
|
|
<div className="flex justify-end items-center gap-4"> |
|
|
|
<Link to="/cart" className="relative"> |
|
|
|
<Link to="/cart" className="relative"> |
|
|
|
<img src={cartIcon} alt="" className="w-11" /> |
|
|
|
<img src={cartIcon} alt="" className="w-8" /> |
|
|
|
<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"> |
|
|
|
<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} |
|
|
|
{cartProductsLength} |
|
|
|
</span> |
|
|
|
</span> |
|
|
|
</Link> |
|
|
|
</Link> |
|
|
|
{/* <img src={whiteCartIcon} alt="" className="w-5 h-5 ml-2" /> */} |
|
|
|
{/* <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" /> */} |
|
|
|
{/* <img src={profileIcon} alt="" className="w-5 h-5" /> */} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
)} |
|
|
|
)} |
|
|
|
</div> |
|
|
|
{1 && ( |
|
|
|
|
|
|
|
|
|
|
|
<div |
|
|
|
|
|
|
|
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 |
|
|
|
|
|
|
|
src={darkCrimsonHamburgerMenu} |
|
|
|
|
|
|
|
alt="" |
|
|
|
|
|
|
|
className="w-8 transform translate-y-1 ml-2" |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
{/* <img src={whiteHamburgerMenu} alt="" className="w-3 h-3" /> */} |
|
|
|
|
|
|
|
<span className={`text-sm text-blue52 ${productCategoryTextColor}`}> |
|
|
|
|
|
|
|
دسته بندی کالاها |
|
|
|
|
|
|
|
</span> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<div |
|
|
|
|
|
|
|
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" |
|
|
|
|
|
|
|
style={{ maxWidth: "calc(100vw / 2)" }} |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
{/* {menuItems.map((item, index) => ( |
|
|
|
|
|
|
|
<a |
|
|
|
|
|
|
|
href="#" |
|
|
|
|
|
|
|
className={`text-sm text-blue52 ${menuItemsColor}`} |
|
|
|
|
|
|
|
key={index} |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
{item} |
|
|
|
|
|
|
|
</a> |
|
|
|
|
|
|
|
))} */} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{pages.map((item, index) => ( |
|
|
|
|
|
|
|
<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: "تماس با ما", |
|
|
|