feat(Projects): refactor project list

This commit is contained in:
Alexander Navarro 2024-03-19 09:34:12 -03:00
parent b97413e816
commit 642e15656e
6 changed files with 69 additions and 52 deletions

View file

@ -0,0 +1,31 @@
---
import { changeLanguage } from "i18next";
import type { InferGetStaticPropsType, GetStaticPaths } from "astro";
import { getCollection } from "astro:content";
import Layout from "@layouts/Layout.astro";
import Toc from "@components/Toc/Toc";
import Gallery from "@components/MediaGallery/Gallery";
changeLanguage("en");
export const getStaticPaths = (async () => {
const entries = await getCollection("portafolio");
return entries.map((entry) => ({
params: { slug: entry.slug },
props: entry,
}));
}) satisfies GetStaticPaths;
type Props = InferGetStaticPropsType<typeof getStaticPaths>;
const entry = Astro.props;
const { Content, headings } = await entry.render();
---
<Layout title={entry.data.title}>
<h1>{entry.data.title}</h1>
<Gallery client:load items={entry.data.media} />
<Toc headings={headings} />
<Content />
</Layout>