2023-07-29 22:40:36 +00:00
|
|
|
import React from 'react'
|
|
|
|
import {SimpleLayout} from '@/components/layouts/SimpleLayout'
|
|
|
|
import {Card} from '@/components/ui/Card'
|
|
|
|
import {Views} from '@/components/ui/Views'
|
|
|
|
import {formatDate} from '@/lib/formatDate'
|
|
|
|
import {getAllArticles} from '@/lib/getAllArticles'
|
2024-10-11 21:01:19 +00:00
|
|
|
import {generateMetadata as _generateMetadata} from '@/lib/generateMetadata'
|
2023-07-29 22:40:36 +00:00
|
|
|
import type {Article} from '@/types'
|
|
|
|
|
2024-10-10 21:32:49 +00:00
|
|
|
const meta = {
|
2024-10-11 21:01:19 +00:00
|
|
|
title: 'Writing',
|
2024-10-10 21:32:49 +00:00
|
|
|
heading: 'Writing on software engineering, and everything in between.',
|
2024-10-11 21:01:19 +00:00
|
|
|
description: 'All of my long-form thoughts on software engineering, and more, displayed in chronological order.',
|
|
|
|
type: 'website'
|
2023-07-29 22:40:36 +00:00
|
|
|
}
|
|
|
|
|
2024-10-11 21:01:19 +00:00
|
|
|
export async function generateMetadata() {
|
|
|
|
return _generateMetadata(meta)
|
2024-10-10 21:32:49 +00:00
|
|
|
}
|
|
|
|
|
2023-07-29 22:40:36 +00:00
|
|
|
function Article({article}: { article: Article }) {
|
|
|
|
return (
|
|
|
|
<article>
|
|
|
|
<Card variant="inline">
|
|
|
|
<Card.Title href={`/writing/${article.slug}`}>
|
|
|
|
{article.title}
|
|
|
|
</Card.Title>
|
|
|
|
<p className="flex order-first space-x-1 z-10 mb-3 md:mb-0 md:ml-4 md:order-last flex-shrink-0">
|
|
|
|
<Card.Eyebrow as="time" dateTime={article.date} decorate={false}>
|
|
|
|
{formatDate(article.date)}
|
|
|
|
</Card.Eyebrow>
|
|
|
|
<Views
|
|
|
|
slug={article.slug}
|
|
|
|
className="text-sm text-zinc-500 dark:text-zinc-400"
|
|
|
|
shouldUpdateViews={false}
|
|
|
|
/>
|
|
|
|
</p>
|
|
|
|
</Card>
|
|
|
|
</article>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default async function Writing() {
|
|
|
|
const articles = (await getAllArticles()).map(({component, ...meta}) => meta)
|
|
|
|
|
|
|
|
return (
|
|
|
|
<SimpleLayout
|
2024-10-11 21:01:19 +00:00
|
|
|
heading={meta.heading}
|
|
|
|
description={meta.description}
|
2023-07-29 22:40:36 +00:00
|
|
|
gradient="bg-gradient-to-r from-pink-500 to-violet-500"
|
|
|
|
>
|
|
|
|
<div className="mx-auto grid max-w-xl grid-cols-1 gap-y-20 lg:max-w-none">
|
|
|
|
<div className="max-w-3xl space-y-16 mt-6">
|
|
|
|
{articles.map((article) => (
|
|
|
|
<Article key={article.slug} article={article}/>
|
|
|
|
))}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</SimpleLayout>
|
|
|
|
)
|
|
|
|
}
|