From 04988b89ac5c9ebfe0d434f8cbc808029e50af1a Mon Sep 17 00:00:00 2001 From: Michael Geers Date: Tue, 4 Jun 2024 09:42:57 +0200 Subject: [PATCH] teaser to database --- src/explore/database/database.json | 12 ++++++++++++ src/explore/database/import.js | 12 ++++++++++++ src/explore/pages/HomePage.js | 16 ++-------------- 3 files changed, 26 insertions(+), 14 deletions(-) diff --git a/src/explore/database/database.json b/src/explore/database/database.json index f8a310a..2c8a98a 100644 --- a/src/explore/database/database.json +++ b/src/explore/database/database.json @@ -1,4 +1,16 @@ { + "teaser": [ + { + "title": "Classic Tractors", + "image": "/cdn/img/scene/[size]/classics.webp", + "url": "/products/classic" + }, + { + "title": "Autonomous Tractors", + "image": "/cdn/img/scene/[size]/autonomous.webp", + "url": "/products/autonomous" + } + ], "categories": [ { "key": "classic", diff --git a/src/explore/database/import.js b/src/explore/database/import.js index 0b61565..164a6de 100644 --- a/src/explore/database/import.js +++ b/src/explore/database/import.js @@ -76,6 +76,18 @@ function toRecoItem(product, variant) { * @type {Database} */ const database = { + teaser: [ + { + title: "Classic Tractors", + image: "/cdn/img/scene/[size]/classics.webp", + url: "/products/classic", + }, + { + title: "Autonomous Tractors", + image: "/cdn/img/scene/[size]/autonomous.webp", + url: "/products/autonomous", + }, + ], categories: [ { key: "classic", diff --git a/src/explore/pages/HomePage.js b/src/explore/pages/HomePage.js index 946faac..b87ba0b 100644 --- a/src/explore/pages/HomePage.js +++ b/src/explore/pages/HomePage.js @@ -1,3 +1,4 @@ +import data from "../database/index.js"; import Header from "../components/Header.js"; import Footer from "../components/Footer.js"; import Recommendations from "../components/Recommendations.js"; @@ -11,19 +12,6 @@ import Meta from "../components/Meta.js"; * @returns {string} The HomePage component markup. */ export default ({ c }) => { - const teaser = [ - { - title: "Classic Tractors", - image: "/cdn/img/scene/[size]/classics.webp", - url: "/products/classic", - }, - { - title: "Autonomous Tractors", - image: "/cdn/img/scene/[size]/autonomous.webp", - url: "/products/autonomous", - }, - ]; - return html` @@ -36,7 +24,7 @@ export default ({ c }) => { ${Header({ c })}
- ${teaser + ${data.teaser .map( ({ title, image, url }) => html`