From 1b057425ac733e45a3bf78ce106cbd64f87fa467 Mon Sep 17 00:00:00 2001 From: Daveed Date: Mon, 9 Dec 2024 12:31:49 -0500 Subject: [PATCH] fixed /product page --- src/pages/newsletter.astro | 15 ++++-- src/pages/products/index.astro | 99 ++++++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+), 4 deletions(-) create mode 100644 src/pages/products/index.astro diff --git a/src/pages/newsletter.astro b/src/pages/newsletter.astro index 954345d..9562bc0 100644 --- a/src/pages/newsletter.astro +++ b/src/pages/newsletter.astro @@ -7,7 +7,10 @@ import Header from "@components/Header.astro"; import Footer from "@components/Footer.astro"; import Layout from "@layouts/Layout.astro"; import Breadcrumbs from "@components/Breadcrumbs.astro"; -import { BlocksRenderer } from "@strapi/blocks-react-renderer"; +import { + BlocksRenderer, + type BlocksContent, +} from "@strapi/blocks-react-renderer"; import Hr from "@components/Hr.astro"; import HeroImage from "@components/HeroImage.astro"; @@ -16,14 +19,14 @@ const page = pages.find(page => page.data.slug === "newsletter")?.data; const stores = await getCollection("stores"); const store = stores?.find( store => store.data.slug === markketplace.STORE_SLUG -)?.data; +); --- -
+
{/* Background decoration */} @@ -50,7 +53,11 @@ const store = stores?.find(
- +

Join our newsletter to get the latest updates and exclusive offers.

diff --git a/src/pages/products/index.astro b/src/pages/products/index.astro new file mode 100644 index 0000000..808ab6d --- /dev/null +++ b/src/pages/products/index.astro @@ -0,0 +1,99 @@ +--- +import type { CollectionEntry } from "astro:content"; +import Layout from "@layouts/Layout.astro"; +import Main from "@layouts/Main.astro"; +import Header from "@components/Header.astro"; +import Footer from "@components/Footer.astro"; +import Pagination from "@components/Pagination.astro"; +import Card from "@components/Card"; +import { SITE } from "@config"; +import HeroImage from "@components/HeroImage.astro"; +import Hr from "@components/Hr.astro"; + +export interface Props { + currentPage: number; + totalPages: number; + stores: CollectionEntry<"stores">[]; +} + +import { getCollection } from "astro:content"; +import type Store from "../interfaces/Store"; +import { slugifyStr } from "@utils/slugify"; +import { markketplace } from "@config"; + +const stores = await getCollection("stores"); +const store = stores.find( + (store: Store) => store.data.slug === markketplace.STORE_SLUG +); + +const products = await getCollection("products"); + +console.log({ products }); + +const { currentPage, totalPages } = Astro.props; +--- + + +
+
+
+ { + store?.data?.SEO?.socialImage && ( + + ) + } +

+ {store?.data?.title} +

+

{store?.data.Description}

+
+
+
+
+
    + { + products.map(({ data }) => ( + + )) + } +
+
+ + + +