martials.no/src/components/projects/ProjectPage.astro

54 lines
1.3 KiB
Plaintext
Raw Normal View History

2024-09-25 22:20:47 +02:00
---
import Layout from "@/layouts/Layout.astro"
import BadgeList from "@/components/badge/BadgeList.astro"
import GiteaLink from "@/components/links/GiteaLink.astro"
import { languageTag } from "@/paraglide/runtime"
import { getEntry, render } from "astro:content"
import { Image } from "astro:assets"
import * as m from "@/paraglide/messages"
import "@/styles/global.css"
2024-09-25 22:20:47 +02:00
interface Props {
project: string // TODO typeof project slug
}
const { project } = Astro.props
const entry = await getEntry("projects", project)
2025-01-19 20:07:26 +01:00
const { Content } = await render(entry!)
2024-09-25 22:20:47 +02:00
const {
title,
description,
tags,
heroImage,
heroImageAlt,
source,
createdAt,
updatedAt,
2024-09-25 22:20:47 +02:00
} = entry!.data
---
<!--TODO day.js / Temporal API for dates?-->
<Layout title={title} class="mx-auto max-w-[750px]">
2024-09-25 22:20:47 +02:00
<div class="flex justify-between my-2">
<div>
<h2>{title}</h2>
2024-09-25 22:20:47 +02:00
<BadgeList tags={tags} />
</div>
<div class="flex flex-col items-end">
<p>
{m.createdAt()}: {new Date(createdAt).toLocaleDateString(languageTag())}
</p>
<p>
{m.updatedAt()}: {new Date(updatedAt).toLocaleDateString(languageTag())}
</p>
</div>
</div>
<Image src={heroImage} alt={heroImageAlt} class="m-auto" />
2024-09-25 22:20:47 +02:00
<GiteaLink href={source} class="my-2" />
2024-09-25 22:20:47 +02:00
<p class="my-2">{description}</p>
<Content />
</Layout>