generated from satnaing/astro-paper
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Daveed
committed
Dec 9, 2024
1 parent
3b2fd74
commit 1b05742
Showing
2 changed files
with
110 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
--- | ||
|
||
<Layout | ||
title={`Posts | ${SITE.title}`} | ||
meta={{ | ||
title: "Products", | ||
description: "Physical & Digital offers from our collective", | ||
}} | ||
> | ||
<Header activeNav="pages" store={store} /> | ||
<main id="main-content"> | ||
<section id="about" class="mb-10 max-w-3xl prose-img:border-0"> | ||
{ | ||
store?.data?.SEO?.socialImage && ( | ||
<HeroImage | ||
image={store?.data?.SEO?.socialImage} | ||
title={store?.data?.title} | ||
/> | ||
) | ||
} | ||
<h1 class="text-2xl tracking-wider sm:text-3xl"> | ||
{store?.data?.title} | ||
</h1> | ||
<p>{store?.data.Description}</p> | ||
</section> | ||
<Hr /> | ||
</main> | ||
<Main | ||
pageTitle="Products" | ||
pageDesc="Some products from artists in this markkët instance" | ||
> | ||
<ul class="-mx-4 flex flex-wrap"> | ||
{ | ||
products.map(({ data }) => ( | ||
<Card | ||
href={`/store/${data.slug || slugifyStr(data.title)}`} | ||
tags={[]} | ||
frontmatter={{ | ||
author: "x", | ||
title: data.Name || data.SEO?.metaTitle || "---", | ||
pubDatetime: new Date(data.createdAt), | ||
modDatetime: new Date(data.updatedAt), | ||
description: data.SEO?.metaDescription || data.Description || "", | ||
SEO: { | ||
...data.SEO, | ||
metaTitle: data.SEO?.metaTitle || data.title || "Store", | ||
socialImage: { | ||
url: data.SEO?.socialImage?.url || data.Thumbnail?.url, | ||
}, | ||
}, | ||
}} | ||
/> | ||
)) | ||
} | ||
</ul> | ||
</Main> | ||
|
||
<Pagination | ||
{currentPage} | ||
{totalPages} | ||
prevUrl={`/blog${currentPage - 1 !== 1 ? "/" + (currentPage - 1) : ""}/`} | ||
nextUrl={`/blog/${currentPage + 1}/`} | ||
/> | ||
|
||
<Footer noMarginTop={totalPages > 1} activeNav="x" /> | ||
</Layout> |