This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
---
|
||||
import { getCollection, render } from 'astro:content';
|
||||
import type { GetStaticPaths } from 'astro';
|
||||
import Base from '../../layouts/Base.astro';
|
||||
|
||||
export const getStaticPaths = (async () => {
|
||||
const all = (await getCollection('projects')).sort((a, b) => a.data.order - b.data.order);
|
||||
return all.map((entry, i) => ({
|
||||
params: { slug: entry.id },
|
||||
props: { entry, prev: all[i - 1], next: all[i + 1], n: i + 1 },
|
||||
}));
|
||||
}) satisfies GetStaticPaths;
|
||||
|
||||
const { entry, prev, next, n } = Astro.props;
|
||||
const { Content } = await render(entry);
|
||||
const d = entry.data;
|
||||
---
|
||||
|
||||
<Base title={`${d.title} — Dylan Benzi`} description={d.summary}>
|
||||
<article class="detail" data-domain={d.domain}>
|
||||
<a class="crumb" href="/#projects">← ALL PROJECTS</a>
|
||||
<h1>{d.title}</h1>
|
||||
<p class="lead">{d.summary}</p>
|
||||
<div class="meta">
|
||||
<div><div class="label">NO.</div><div class="val">{String(n).padStart(2, '0')}</div></div>
|
||||
<div><div class="label">DOMAIN</div><div class="val" style="color:var(--dc)">{d.domainLabel}</div></div>
|
||||
<div><div class="label">{d.whenLabel}</div><div class="val">{d.when}</div></div>
|
||||
{d.tech.length > 0 && <div style="flex-basis:320px"><div class="label">TECH</div><div class="val">{d.tech.join(' · ')}</div></div>}
|
||||
</div>
|
||||
<div class="prose"><Content /></div>
|
||||
{
|
||||
d.links.length > 0 && (
|
||||
<div class="links">
|
||||
{d.links.map((l) => <a class="btn" href={l.href}>{l.label} ↗</a>)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
<div class="pager">
|
||||
{prev ? <a href={`/projects/${prev.id}/`}>← {prev.data.title}</a> : <span />}
|
||||
{next ? <a href={`/projects/${next.id}/`}>{next.data.title} →</a> : <span />}
|
||||
</div>
|
||||
</article>
|
||||
</Base>
|
||||
Reference in New Issue
Block a user