diff options
Diffstat (limited to 'src/ui/components/ReleaseCard.tsx')
| -rw-r--r-- | src/ui/components/ReleaseCard.tsx | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/ui/components/ReleaseCard.tsx b/src/ui/components/ReleaseCard.tsx new file mode 100644 index 0000000..bffe256 --- /dev/null +++ b/src/ui/components/ReleaseCard.tsx | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | import type { Select } from "corvos"; | ||
| 2 | |||
| 3 | import type site from "@/corvos.config.ts"; | ||
| 4 | |||
| 5 | import { CardBody } from "$/ui/objects/CardBody.tsx"; | ||
| 6 | import { Heading } from "$/ui/objects/Heading.tsx"; | ||
| 7 | |||
| 8 | import { Card, type Props as CardProps } from "../objects/Card.tsx"; | ||
| 9 | |||
| 10 | export type Props = CardProps<"a"> & { | ||
| 11 | "heading-level": "h1" | "h2" | "h3" | "h4" | "h5" | "h6"; | ||
| 12 | "page": Select<typeof site, ".html", { type: "release" }>; | ||
| 13 | }; | ||
| 14 | |||
| 15 | export const ReleaseCard = ({ "heading-level": headingLevel, page, ...props }: Props) => { | ||
| 16 | return ( | ||
| 17 | <Card | ||
| 18 | as="a" | ||
| 19 | class="c-with-visited-indicator h-entry u-url" | ||
| 20 | horizontal | ||
| 21 | href={page.url} | ||
| 22 | {...props} | ||
| 23 | > | ||
| 24 | <CardBody class="c-with-visited-indicator__indicator u-pie-0" /> | ||
| 25 | |||
| 26 | <CardBody main> | ||
| 27 | <Heading as={headingLevel} class="p-name"> | ||
| 28 | <span class="u-mie-100">{page.data.title}</span> | ||
| 29 | </Heading> | ||
| 30 | </CardBody> | ||
| 31 | |||
| 32 | <CardBody as="small" class="u-c-mute u-d-none@sm-lo"> | ||
| 33 | <ul class="l-hlist l-hlist--separated"> | ||
| 34 | <li class="l-hlist__item"> | ||
| 35 | <time class="dt-published" datetime={page.data.date.toISOString()}> | ||
| 36 | {page.data.date.toLocaleDateString(undefined, { | ||
| 37 | day: "numeric", | ||
| 38 | month: "short", | ||
| 39 | year: "numeric", | ||
| 40 | })} | ||
| 41 | </time> | ||
| 42 | </li> | ||
| 43 | </ul> | ||
| 44 | </CardBody> | ||
| 45 | </Card> | ||
| 46 | ); | ||
| 47 | }; | ||
