|
|
@@ -9,7 +9,8 @@ import {
|
|
9
|
9
|
IconButton,
|
|
10
|
10
|
Drawer,
|
|
11
|
11
|
InputBase,
|
|
12
|
|
- Tooltip
|
|
|
12
|
+ Tooltip,
|
|
|
13
|
+ Collapse
|
|
13
|
14
|
} from "@mui/material";
|
|
14
|
15
|
import AddIcon from '@mui/icons-material/Add';
|
|
15
|
16
|
import RemoveIcon from '@mui/icons-material/Remove';
|
|
|
@@ -359,7 +360,6 @@ const ProductDetails = () => {
|
|
359
|
360
|
|
|
360
|
361
|
const toggleInfoRow = (row) => {
|
|
361
|
362
|
setExpandedInfoRows((prevRows) => ({
|
|
362
|
|
- ...prevRows,
|
|
363
|
363
|
[row]: !prevRows[row]
|
|
364
|
364
|
}))
|
|
365
|
365
|
}
|
|
|
@@ -382,6 +382,20 @@ const ProductDetails = () => {
|
|
382
|
382
|
transition: "padding-bottom 0.25s ease-in-out"
|
|
383
|
383
|
})
|
|
384
|
384
|
|
|
|
385
|
+ const infoPanelSx = {
|
|
|
386
|
+ borderBottom: "1px solid #DDD"
|
|
|
387
|
+ }
|
|
|
388
|
+
|
|
|
389
|
+ const infoPanelContentSx = {
|
|
|
390
|
+ color: "text.secondary",
|
|
|
391
|
+ fontSize: {
|
|
|
392
|
+ xs: "0.875rem",
|
|
|
393
|
+ md: "1rem"
|
|
|
394
|
+ },
|
|
|
395
|
+ lineHeight: 1.6,
|
|
|
396
|
+ pb: 2.5
|
|
|
397
|
+ }
|
|
|
398
|
+
|
|
385
|
399
|
const materialMetafield = product?.metafields?.material
|
|
386
|
400
|
const careInstructionMetafield = product?.metafields?.care_instruction
|
|
387
|
401
|
const shippingInformationMetafield = product?.metafields?.shipping_information
|
|
|
@@ -394,127 +408,76 @@ const ProductDetails = () => {
|
|
394
|
408
|
|
|
395
|
409
|
// Renders Shopify product metafield custom.material inside the Material row.
|
|
396
|
410
|
const materialPanel = (
|
|
397
|
|
- <Box
|
|
398
|
|
- sx={{
|
|
399
|
|
- maxHeight: expandedInfoRows.material ? 600 : 0,
|
|
400
|
|
- overflow: "hidden",
|
|
401
|
|
- borderBottom: "1px solid #DDD",
|
|
402
|
|
- transition: "max-height 0.25s ease-in-out"
|
|
403
|
|
- }}
|
|
404
|
|
- >
|
|
|
411
|
+ <Box sx={infoPanelSx}>
|
|
|
412
|
+ <Collapse in={Boolean(expandedInfoRows.material)} timeout="auto">
|
|
405
|
413
|
<Box
|
|
406
|
414
|
sx={{
|
|
407
|
|
- color: "text.secondary",
|
|
|
415
|
+ ...infoPanelContentSx,
|
|
408
|
416
|
minHeight: materialMetafield?.value ? 0 : 28,
|
|
409
|
|
- fontSize: {
|
|
410
|
|
- xs: "0.875rem",
|
|
411
|
|
- md: "1rem"
|
|
412
|
|
- },
|
|
413
|
|
- lineHeight: 1.6
|
|
414
|
417
|
}}
|
|
415
|
418
|
>
|
|
416
|
419
|
{renderShopifyRichText(materialMetafield?.value)}
|
|
417
|
420
|
</Box>
|
|
|
421
|
+ </Collapse>
|
|
418
|
422
|
</Box>
|
|
419
|
423
|
)
|
|
420
|
424
|
|
|
421
|
425
|
// Renders Shopify product metafield custom.care_instruction inside the Care Instruction row.
|
|
422
|
426
|
const careInstructionPanel = (
|
|
423
|
|
- <Box
|
|
424
|
|
- sx={{
|
|
425
|
|
- maxHeight: expandedInfoRows.careInstruction ? 600 : 0,
|
|
426
|
|
- overflow: "hidden",
|
|
427
|
|
- borderBottom: "1px solid #DDD",
|
|
428
|
|
- transition: "max-height 0.25s ease-in-out"
|
|
429
|
|
- }}
|
|
430
|
|
- >
|
|
|
427
|
+ <Box sx={infoPanelSx}>
|
|
|
428
|
+ <Collapse in={Boolean(expandedInfoRows.careInstruction)} timeout="auto">
|
|
431
|
429
|
<Box
|
|
432
|
430
|
sx={{
|
|
433
|
|
- color: "text.secondary",
|
|
|
431
|
+ ...infoPanelContentSx,
|
|
434
|
432
|
minHeight: careInstructionMetafield?.value ? 0 : 28,
|
|
435
|
|
- fontSize: {
|
|
436
|
|
- xs: "0.875rem",
|
|
437
|
|
- md: "1rem"
|
|
438
|
|
- },
|
|
439
|
|
- lineHeight: 1.6
|
|
440
|
433
|
}}
|
|
441
|
434
|
>
|
|
442
|
435
|
{renderShopifyRichText(careInstructionMetafield?.value)}
|
|
443
|
436
|
</Box>
|
|
|
437
|
+ </Collapse>
|
|
444
|
438
|
</Box>
|
|
445
|
439
|
)
|
|
446
|
440
|
|
|
447
|
441
|
// Renders Shopify product metafield custom.shipping_information inside the Shipping Information row.
|
|
448
|
442
|
const shippingInformationPanel = (
|
|
449
|
|
- <Box
|
|
450
|
|
- sx={{
|
|
451
|
|
- maxHeight: expandedInfoRows.shippingInformation ? 600 : 0,
|
|
452
|
|
- overflow: "hidden",
|
|
453
|
|
- borderBottom: "1px solid #DDD",
|
|
454
|
|
- transition: "max-height 0.25s ease-in-out"
|
|
455
|
|
- }}
|
|
456
|
|
- >
|
|
|
443
|
+ <Box sx={infoPanelSx}>
|
|
|
444
|
+ <Collapse in={Boolean(expandedInfoRows.shippingInformation)} timeout="auto">
|
|
457
|
445
|
<Box
|
|
458
|
446
|
sx={{
|
|
459
|
|
- color: "text.secondary",
|
|
|
447
|
+ ...infoPanelContentSx,
|
|
460
|
448
|
minHeight: shippingInformationMetafield?.value ? 0 : 28,
|
|
461
|
|
- fontSize: {
|
|
462
|
|
- xs: "0.875rem",
|
|
463
|
|
- md: "1rem"
|
|
464
|
|
- },
|
|
465
|
|
- lineHeight: 1.6
|
|
466
|
449
|
}}
|
|
467
|
450
|
>
|
|
468
|
451
|
{renderShopifyRichText(shippingInformationMetafield?.value)}
|
|
469
|
452
|
</Box>
|
|
|
453
|
+ </Collapse>
|
|
470
|
454
|
</Box>
|
|
471
|
455
|
)
|
|
472
|
456
|
|
|
473
|
457
|
// Renders Shopify product metafield custom.return_exchange inside the Return & Exchanges row.
|
|
474
|
458
|
const returnExchangesPanel = (
|
|
475
|
|
- <Box
|
|
476
|
|
- sx={{
|
|
477
|
|
- maxHeight: expandedInfoRows.returnExchanges ? 600 : 0,
|
|
478
|
|
- overflow: "hidden",
|
|
479
|
|
- borderBottom: "1px solid #DDD",
|
|
480
|
|
- transition: "max-height 0.25s ease-in-out"
|
|
481
|
|
- }}
|
|
482
|
|
- >
|
|
|
459
|
+ <Box sx={infoPanelSx}>
|
|
|
460
|
+ <Collapse in={Boolean(expandedInfoRows.returnExchanges)} timeout="auto">
|
|
483
|
461
|
<Box
|
|
484
|
462
|
sx={{
|
|
485
|
|
- color: "text.secondary",
|
|
|
463
|
+ ...infoPanelContentSx,
|
|
486
|
464
|
minHeight: returnExchangeMetafield?.value ? 0 : 28,
|
|
487
|
|
- fontSize: {
|
|
488
|
|
- xs: "0.875rem",
|
|
489
|
|
- md: "1rem"
|
|
490
|
|
- },
|
|
491
|
|
- lineHeight: 1.6
|
|
492
|
465
|
}}
|
|
493
|
466
|
>
|
|
494
|
467
|
{renderShopifyRichText(returnExchangeMetafield?.value)}
|
|
495
|
468
|
</Box>
|
|
|
469
|
+ </Collapse>
|
|
496
|
470
|
</Box>
|
|
497
|
471
|
)
|
|
498
|
472
|
|
|
499
|
473
|
// Renders Shopify product metafield custom.product_details inside the Product Details row.
|
|
500
|
474
|
const productDetailsPanel = (
|
|
501
|
|
- <Box
|
|
502
|
|
- sx={{
|
|
503
|
|
- maxHeight: expandedInfoRows.productDetails ? 1200 : 0,
|
|
504
|
|
- overflow: "hidden",
|
|
505
|
|
- borderBottom: "1px solid #DDD",
|
|
506
|
|
- transition: "max-height 0.25s ease-in-out"
|
|
507
|
|
- }}
|
|
508
|
|
- >
|
|
|
475
|
+ <Box sx={infoPanelSx}>
|
|
|
476
|
+ <Collapse in={Boolean(expandedInfoRows.productDetails)} timeout="auto">
|
|
509
|
477
|
<Box
|
|
510
|
478
|
sx={{
|
|
511
|
|
- color: "text.secondary",
|
|
|
479
|
+ ...infoPanelContentSx,
|
|
512
|
480
|
minHeight: productDetailsMetafield?.value ? 0 : 28,
|
|
513
|
|
- fontSize: {
|
|
514
|
|
- xs: "0.875rem",
|
|
515
|
|
- md: "1rem"
|
|
516
|
|
- },
|
|
517
|
|
- lineHeight: 1.6,
|
|
518
|
481
|
"& > div > *:first-child": {
|
|
519
|
482
|
borderTop: "none !important",
|
|
520
|
483
|
marginTop: "0 !important",
|
|
|
@@ -542,6 +505,7 @@ const ProductDetails = () => {
|
|
542
|
505
|
>
|
|
543
|
506
|
{renderShopifyRichText(productDetailsMetafield?.value)}
|
|
544
|
507
|
</Box>
|
|
|
508
|
+ </Collapse>
|
|
545
|
509
|
</Box>
|
|
546
|
510
|
)
|
|
547
|
511
|
|