Просмотр исходного кода

feat module 2 : modified navigation bar (remove menu, rename menu) - website, mobile

master
nadia 1 день назад
Родитель
Сommit
c753a5c048

+ 9
- 1
src/components/Navbar/Navbar.jsx Просмотреть файл

@@ -83,6 +83,10 @@ const COLLECTION_PRIORITY_BY_TYPE = {
83 83
 
84 84
 const normalizeTitle = (value = "") => value.trim().toUpperCase();
85 85
 
86
+const getProductTypeMenuLabel = (productType = "") => {
87
+  return normalizeTitle(productType) === "BEAUTY" ? "Essentials" : productType;
88
+};
89
+
86 90
 const sortCollectionsByPriority = (collection = [], productType = "") => {
87 91
   const typeKey = (productType || "").trim().toLowerCase();
88 92
   const priorityList = COLLECTION_PRIORITY_BY_TYPE[typeKey] || [];
@@ -216,10 +220,13 @@ const Navbar = () => {
216 220
 
217 221
       let navItemData = mapProductTypesWithCollections(products)
218 222
       navItemData = getUniqueCollections(navItemData)
223
+      navItemData = navItemData.filter(({ productType }) => normalizeTitle(productType) !== "HOME")
219 224
 
220 225
       setNavItem(navItemData)
221 226
 
222 227
       // extra info for the navbar
228
+      setNavItemCompanyInfo([]);
229
+      /*
223 230
       setNavItemCompanyInfo([{
224 231
         name:"DELIVERY INFORMATION",
225 232
         link:"/delivery_info"
@@ -236,6 +243,7 @@ const Navbar = () => {
236 243
         name:"CONTACT US",
237 244
         link:"/contact_us"
238 245
       }]);
246
+      */
239 247
 
240 248
     }
241 249
 
@@ -480,7 +488,7 @@ const Navbar = () => {
480 488
                     ":hover::after": {
481 489
                       width: "50%", // Expands on hover
482 490
                     },
483
-                  }}>{productType}</Typography>
491
+                  }}>{getProductTypeMenuLabel(productType)}</Typography>
484 492
               </Button>))}
485 493
 
486 494
               {navItemCompanyInfo.map(({ name, link }) => (<Button

+ 5
- 1
src/components/Navbar/components/MobileNav/MobileNav.jsx Просмотреть файл

@@ -5,6 +5,10 @@ import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
5 5
 import Grid from '@mui/material/Grid2';
6 6
 import logoSrc from "../../../../assets/images/amberlogo.png";
7 7
 
8
+const getProductTypeMenuLabel = (productType = "") => {
9
+  return productType.trim().toUpperCase() === "BEAUTY" ? "Essentials" : productType;
10
+};
11
+
8 12
 const MobileNav = ({ open, onClose, menu = [], infomenu = [] }) => {
9 13
 
10 14
   // React.useEffect(()=>{
@@ -153,7 +157,7 @@ const MobileNav = ({ open, onClose, menu = [], infomenu = [] }) => {
153 157
                   },
154 158
                 }}
155 159
               >
156
-                {productType?.toUpperCase()}
160
+                {getProductTypeMenuLabel(productType)?.toUpperCase()}
157 161
               </Typography>
158 162
             </AccordionSummary>
159 163
             <AccordionDetails>

+ 2
- 1
src/pages/Home.jsx Просмотреть файл

@@ -76,7 +76,8 @@ const Home = () => {
76 76
               <ProductType title={'Apparel'} img_url={AmberClothing}/>
77 77
             </Grid>
78 78
             <Grid size={{xs:12, md:6}}>
79
-              <ProductType title={'BEAUTY'} img_url={AmberBeautyWallpaper}/>
79
+              {/* <ProductType title={'BEAUTY'} img_url={AmberBeautyWallpaper}/> */}
80
+              <ProductType title={'Essentials'} img_url={AmberBeautyWallpaper}/>
80 81
             </Grid>
81 82
             <Grid size={{xs:12, md:6}}>
82 83
               <ProductType title={'HOME'} img_url={AmberHomeWallpaper} />

Загрузка…
Отмена
Сохранить