Files
github-website/src/components/BlogItem.astro

41 lines
1.2 KiB
Plaintext

---
import TerminalBorder from "@components/TerminalBorder.astro";
function formatDate(date: Date) {
const day = date.getDate();
const month = date.toLocaleString("default", { month: "long" });
const year = date.getFullYear();
return `${month} ${day}, ${year}`;
}
interface Props {
title: string;
description: string;
date: Date;
href?: string;
header?: string;
}
const { title, description, date, href, header } = Astro.props;
---
<TerminalBorder header={header} footer={formatDate(date)} margin="0 0 20px;">
<span class="cursor-pointer group block w-full">
{
href ? (
<a href={href} style="all: unset;">
<h1 class="text-[130%] text-[var(--accent)] group-hover:underline">
{title}
</h1>
<p class="text-[var(--secondary)]">{description}</p>
</a>
) : (
<>
<h1 class="text-[130%] text-[var(--accent)]">{title}</h1>
<p class="text-[var(--secondary)]">{description}</p>
</>
)
}
</span>
</TerminalBorder>