diff --git a/src/content/config.ts b/src/content/config.ts index f095b80..dbb14b8 100644 --- a/src/content/config.ts +++ b/src/content/config.ts @@ -46,6 +46,12 @@ const productsCollection = defineCollection({ subTitle: z.string(), }) ).optional(), + tableData: z.array( + z.object({ + feature: z.array(z.string()), + description: z.array(z.array(z.string())), + }) + ).optional(), blueprints: z.object({ first: image().optional(), second: image().optional(), diff --git a/src/content/products/a765.md b/src/content/products/a765.md index 59e6745..3255c59 100644 --- a/src/content/products/a765.md +++ b/src/content/products/a765.md @@ -1,6 +1,6 @@ --- title: "SF-AB A765" -description: "Assorted Screw Set" +description: " " main: id: 2 content: | @@ -40,15 +40,14 @@ specificationsLeft: subTitle: "Each set includes a sufficient quantity of screws to handle a wide range of projects and tasks." - title: "Sizes" subTitle: "Available in various sizes to suit different project requirements, ensuring compatibility and versatility." -specificationsRight: - - title: "Thread Design" - subTitle: "Precision-engineered threads ensure a tight and secure fit, providing reliable fastening for your projects." - - title: "Durability" - subTitle: "Designed to withstand the rigors of everyday use, delivering long-lasting performance and reliability." - - title: "Quality Assurance" - subTitle: "Manufactured to meet or exceed industry standards, guaranteeing consistent quality and performance." - - title: "Applications" - subTitle: "Suitable for a wide range of applications, including woodworking, metalworking, construction, and more." +tableData: + - feature: ["Specification", "Value"] + description: + - ["Length (mm)", "Various"] + - ["Weight (g)", "N/A"] + - ["Material", "Stainless Steel"] + - ["Finish", "Assorted"] + - ["Package Contents", "Various screws in a set"] blueprints: first: "@/images/blueprint-1.avif" second: "@/images/blueprint-2.avif" diff --git a/src/pages/products/[...slug].astro b/src/pages/products/[...slug].astro index 0e180cc..b3a40a9 100644 --- a/src/pages/products/[...slug].astro +++ b/src/pages/products/[...slug].astro @@ -148,20 +148,65 @@ const pageTitle: string = `${product.data.title} | ${SITE.title}`; )) } -
- { - product.data.specificationsRight?.map((spec) => ( -
-

- {spec.title} -

-

- {spec.subTitle} -

+ { + product.data.specificationsRight ? ( +
+ {product.data.specificationsRight?.map((spec) => ( +
+

+ {spec.title} +

+

+ {spec.subTitle} +

+
+ ))} +
+ ) : product.data.tableData ? ( +
+
+
+
+
+ + + + {product.data.tableData?.[0].feature?.map( + (header) => ( + + ) + )} + + + + {product.data.tableData?.map((row) => + // Wrap each row's content in a separate element + row.description.map((rowData) => ( + + {/* Iterate through each cell value in the row's description array */} + {rowData.map((cellValue) => ( + // Render each cell value in its own + ))} + + )) + )} + +
+ {header} +
element + + {cellValue} +
+
+
+
- )) - } -
+
+ ) : null + }
@@ -199,7 +244,7 @@ const pageTitle: string = `${product.data.title} | ${SITE.title}`; - + - + \ No newline at end of file