summaryrefslogtreecommitdiffstats
path: root/src/ui/components/ReleaseCard.tsx
blob: bffe256c7b1c70e984f155ba9db075c39fc2593e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import type { Select } from "corvos";

import type site from "@/corvos.config.ts";

import { CardBody } from "$/ui/objects/CardBody.tsx";
import { Heading } from "$/ui/objects/Heading.tsx";

import { Card, type Props as CardProps } from "../objects/Card.tsx";

export type Props = CardProps<"a"> & {
	"heading-level": "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
	"page": Select<typeof site, ".html", { type: "release" }>;
};

export const ReleaseCard = ({ "heading-level": headingLevel, page, ...props }: Props) => {
	return (
		<Card
			as="a"
			class="c-with-visited-indicator h-entry u-url"
			horizontal
			href={page.url}
			{...props}
		>
			<CardBody class="c-with-visited-indicator__indicator u-pie-0" />

			<CardBody main>
				<Heading as={headingLevel} class="p-name">
					<span class="u-mie-100">{page.data.title}</span>
				</Heading>
			</CardBody>

			<CardBody as="small" class="u-c-mute u-d-none@sm-lo">
				<ul class="l-hlist l-hlist--separated">
					<li class="l-hlist__item">
						<time class="dt-published" datetime={page.data.date.toISOString()}>
							{page.data.date.toLocaleDateString(undefined, {
								day: "numeric",
								month: "short",
								year: "numeric",
							})}
						</time>
					</li>
				</ul>
			</CardBody>
		</Card>
	);
};