---
import { getCollection, render } from "astro:content";
import ProjectLayout from "../../layouts/ProjectLayout.astro";

export async function getStaticPaths() {
  const projectEntries = await getCollection("projects");

  return projectEntries.map((entry) => ({
    params: { slug: entry.id },
    props: { entry },
  }));
}

const { entry } = Astro.props;
const { Content } = await render(entry);
---

<ProjectLayout
  title={entry.data.title}
  description={entry.data.description}
  image={entry.data.image}
  tags={entry.data.tags}
  demoLink={entry.data.demoLink}
  url={entry.data.url}
  sourceLink={entry.data.sourceLink}
>
  <Content />
</ProjectLayout>
