|
|
@@ -132,6 +132,7 @@ const ProductDetails = () => {
|
|
132
|
132
|
const [variants, setVariants] = useState([])
|
|
133
|
133
|
const [showLoader, setShowLoader] = useState(false)
|
|
134
|
134
|
const [atomeOpen, setAtomeOpen] = useState(false)
|
|
|
135
|
+ const [sizeChartOpen, setSizeChartOpen] = useState(false)
|
|
135
|
136
|
const [storeAvailabilityOpen, setStoreAvailabilityOpen] = useState(false)
|
|
136
|
137
|
const [storeSearch, setStoreSearch] = useState("")
|
|
137
|
138
|
const [expandedStoreRows, setExpandedStoreRows] = useState({})
|
|
|
@@ -391,6 +392,9 @@ const ProductDetails = () => {
|
|
391
|
392
|
const shippingInformationMetafield = product?.metafields?.shipping_information
|
|
392
|
393
|
const returnExchangeMetafield = product?.metafields?.return_exchange
|
|
393
|
394
|
const productDetailsMetafield = product?.metafields?.product_details
|
|
|
395
|
+ const sizeChartMetafield = product?.metafields?.size_chart
|
|
|
396
|
+ const sizeChartImageUrl = sizeChartMetafield?.reference?.image?.url || sizeChartMetafield?.reference?.url || ""
|
|
|
397
|
+ const sizeChartImageAlt = sizeChartMetafield?.reference?.image?.altText || `${product?.title || "Product"} size chart`
|
|
394
|
398
|
|
|
395
|
399
|
// Renders Shopify product metafield custom.material inside the Material row.
|
|
396
|
400
|
const materialPanel = (
|
|
|
@@ -713,7 +717,11 @@ const ProductDetails = () => {
|
|
713
|
717
|
|
|
714
|
718
|
<Box
|
|
715
|
719
|
component="a"
|
|
716
|
|
- href="#"
|
|
|
720
|
+ href={sizeChartImageUrl || "#"}
|
|
|
721
|
+ onClick={(event) => {
|
|
|
722
|
+ event.preventDefault()
|
|
|
723
|
+ if (sizeChartImageUrl) setSizeChartOpen(true)
|
|
|
724
|
+ }}
|
|
717
|
725
|
sx={{
|
|
718
|
726
|
display: "inline-flex",
|
|
719
|
727
|
alignItems: "center",
|
|
|
@@ -721,7 +729,8 @@ const ProductDetails = () => {
|
|
721
|
729
|
textDecoration: "underline",
|
|
722
|
730
|
textTransform: "uppercase",
|
|
723
|
731
|
fontSize: "0.875rem",
|
|
724
|
|
- mb: 1
|
|
|
732
|
+ mb: 1,
|
|
|
733
|
+ cursor: sizeChartImageUrl ? "pointer" : "default"
|
|
725
|
734
|
}}
|
|
726
|
735
|
>
|
|
727
|
736
|
<StraightenIcon sx={{ mr: 0.75, fontSize: 20 }} />
|
|
|
@@ -1139,6 +1148,57 @@ const ProductDetails = () => {
|
|
1139
|
1148
|
</Box>
|
|
1140
|
1149
|
</Dialog>
|
|
1141
|
1150
|
|
|
|
1151
|
+ {/* Size Chart Popup */}
|
|
|
1152
|
+ <Dialog
|
|
|
1153
|
+ open={sizeChartOpen}
|
|
|
1154
|
+ onClose={() => setSizeChartOpen(false)}
|
|
|
1155
|
+ maxWidth={false}
|
|
|
1156
|
+ PaperProps={{
|
|
|
1157
|
+ sx: {
|
|
|
1158
|
+ borderRadius: 1,
|
|
|
1159
|
+ backgroundColor: "#FFF",
|
|
|
1160
|
+ width: { xs: "calc(100% - 32px)", md: "auto" },
|
|
|
1161
|
+ maxWidth: { xs: "calc(100% - 32px)", md: "90vw" },
|
|
|
1162
|
+ maxHeight: "90vh",
|
|
|
1163
|
+ p: { xs: 1.5, md: 2 },
|
|
|
1164
|
+ position: "relative",
|
|
|
1165
|
+ overflow: "visible"
|
|
|
1166
|
+ }
|
|
|
1167
|
+ }}
|
|
|
1168
|
+ >
|
|
|
1169
|
+ <IconButton
|
|
|
1170
|
+ aria-label="Close size chart"
|
|
|
1171
|
+ onClick={() => setSizeChartOpen(false)}
|
|
|
1172
|
+ sx={{
|
|
|
1173
|
+ position: "absolute",
|
|
|
1174
|
+ right: { xs: -12, md: -16 },
|
|
|
1175
|
+ top: { xs: -12, md: -16 },
|
|
|
1176
|
+ backgroundColor: "#FFF",
|
|
|
1177
|
+ color: "#000",
|
|
|
1178
|
+ zIndex: 1,
|
|
|
1179
|
+ boxShadow: "0 1px 4px rgba(0,0,0,0.2)",
|
|
|
1180
|
+ "&:hover": {
|
|
|
1181
|
+ backgroundColor: "#FFF"
|
|
|
1182
|
+ }
|
|
|
1183
|
+ }}
|
|
|
1184
|
+ >
|
|
|
1185
|
+ <CloseIcon sx={{ fontSize: { xs: 24, md: 30 } }} />
|
|
|
1186
|
+ </IconButton>
|
|
|
1187
|
+
|
|
|
1188
|
+ <Box
|
|
|
1189
|
+ component="img"
|
|
|
1190
|
+ src={sizeChartImageUrl}
|
|
|
1191
|
+ alt={sizeChartImageAlt}
|
|
|
1192
|
+ sx={{
|
|
|
1193
|
+ display: "block",
|
|
|
1194
|
+ width: "100%",
|
|
|
1195
|
+ maxWidth: { xs: "100%", md: "80vw" },
|
|
|
1196
|
+ maxHeight: "80vh",
|
|
|
1197
|
+ objectFit: "contain"
|
|
|
1198
|
+ }}
|
|
|
1199
|
+ />
|
|
|
1200
|
+ </Dialog>
|
|
|
1201
|
+
|
|
1142
|
1202
|
{/* Store Availability Sidebar */}
|
|
1143
|
1203
|
<Drawer
|
|
1144
|
1204
|
anchor="right"
|