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

feat module 6, 7 : pull Shipping Information data from shopify, include Shipping Information identifiers in product service

master
nadia 12 часов назад
Родитель
Сommit
c7100abe67
2 измененных файлов: 37 добавлений и 3 удалений
  1. 35
    2
      src/components/ProductDetails/ProductDetails.jsx
  2. 2
    1
      src/services/ProductService.js

+ 35
- 2
src/components/ProductDetails/ProductDetails.jsx Просмотреть файл

400
 
400
 
401
   const materialMetafield = product?.metafields?.material
401
   const materialMetafield = product?.metafields?.material
402
   const careInstructionMetafield = product?.metafields?.care_instruction
402
   const careInstructionMetafield = product?.metafields?.care_instruction
403
+  const shippingInformationMetafield = product?.metafields?.shipping_information
403
 
404
 
404
   // Renders Shopify product metafield custom.material inside the Material row.
405
   // Renders Shopify product metafield custom.material inside the Material row.
405
   const materialPanel = (
406
   const materialPanel = (
453
     </Box>
454
     </Box>
454
   )
455
   )
455
 
456
 
457
+  // Renders Shopify product metafield custom.shipping_information inside the Shipping Information row.
458
+  const shippingInformationPanel = (
459
+    <Box
460
+      sx={{
461
+        maxHeight: expandedInfoRows.shippingInformation ? 600 : 0,
462
+        overflow: "hidden",
463
+        borderBottom: "1px solid #DDD",
464
+        transition: "max-height 0.25s ease-in-out"
465
+      }}
466
+    >
467
+      <Box
468
+        sx={{
469
+          // Old extra panel spacing kept for reference:
470
+          // pb: 3,
471
+          color: "text.secondary",
472
+          minHeight: shippingInformationMetafield?.value ? 0 : 28,
473
+          fontSize: {
474
+            xs: "0.875rem",
475
+            md: "1rem"
476
+          },
477
+          lineHeight: 1.6
478
+        }}
479
+      >
480
+        {renderShopifyRichText(shippingInformationMetafield?.value)}
481
+      </Box>
482
+    </Box>
483
+  )
484
+
456
   const productDetailsPanel = (
485
   const productDetailsPanel = (
457
     <Box
486
     <Box
458
       sx={{
487
       sx={{
892
           {/* Shipping Information */}
921
           {/* Shipping Information */}
893
           <Box
922
           <Box
894
             onClick={() => toggleInfoRow("shippingInformation")}
923
             onClick={() => toggleInfoRow("shippingInformation")}
895
-            sx={infoRowSx(expandedInfoRows.shippingInformation)}
924
+            sx={{
925
+              ...infoRowSx(expandedInfoRows.shippingInformation),
926
+              pb: 2,
927
+              borderBottom: "none"
928
+            }}
896
           >
929
           >
897
             <Typography variant="body2" sx={{ textTransform: "uppercase", fontWeight: "400", fontSize: { xs: "0.875rem", md: "1.1rem" } }}>
930
             <Typography variant="body2" sx={{ textTransform: "uppercase", fontWeight: "400", fontSize: { xs: "0.875rem", md: "1.1rem" } }}>
898
               Shipping Information
931
               Shipping Information
899
             </Typography>
932
             </Typography>
900
             {expandedInfoRows.shippingInformation ? <RemoveIcon sx={{ fontSize: 18 }} /> : <AddIcon sx={{ fontSize: 18 }} />}
933
             {expandedInfoRows.shippingInformation ? <RemoveIcon sx={{ fontSize: 18 }} /> : <AddIcon sx={{ fontSize: 18 }} />}
901
           </Box>
934
           </Box>
902
-          {emptyInfoPanel("shippingInformation")}
935
+          {shippingInformationPanel}
903
 
936
 
904
           {/* Return & Exchanges */}
937
           {/* Return & Exchanges */}
905
           <Box
938
           <Box

+ 2
- 1
src/services/ProductService.js Просмотреть файл

168
           {key: "published_date", namespace: "custom"},
168
           {key: "published_date", namespace: "custom"},
169
           {key: "selected", namespace: "custom"},
169
           {key: "selected", namespace: "custom"},
170
           {key: "material", namespace: "custom"},
170
           {key: "material", namespace: "custom"},
171
-          {key: "care_instruction", namespace: "custom"}
171
+          {key: "care_instruction", namespace: "custom"},
172
+          {key: "shipping_information", namespace: "custom"}
172
         ]
173
         ]
173
       ) {
174
       ) {
174
         namespace
175
         namespace

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