diff options
| author | Yuqian Yang <crupest@crupest.life> | 2026-01-23 23:16:45 +0800 |
|---|---|---|
| committer | Yuqian Yang <crupest@crupest.life> | 2026-01-24 16:38:33 +0800 |
| commit | 6d39cee75e7ef7c5e06d1a745a32224e11d68c37 (patch) | |
| tree | 0f2646b569e8af6a2f464eb2755553eda0fe593b /www-2/src/components/ArticlePreview.astro | |
| parent | 78e3e234877cb10ca1088df31e831b36fa4a12c0 (diff) | |
| download | crupest-6d39cee75e7ef7c5e06d1a745a32224e11d68c37.tar.gz crupest-6d39cee75e7ef7c5e06d1a745a32224e11d68c37.tar.bz2 crupest-6d39cee75e7ef7c5e06d1a745a32224e11d68c37.zip | |
HALF WORK!astro
Diffstat (limited to 'www-2/src/components/ArticlePreview.astro')
| -rw-r--r-- | www-2/src/components/ArticlePreview.astro | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/www-2/src/components/ArticlePreview.astro b/www-2/src/components/ArticlePreview.astro index 3301ad2..bce8b50 100644 --- a/www-2/src/components/ArticlePreview.astro +++ b/www-2/src/components/ArticlePreview.astro @@ -1,22 +1,25 @@ --- -interface Props { - title: string; - date: string; - url: string; - content: string; +import type { CollectionEntry } from "astro:content"; + +export type Props = { + article: CollectionEntry<"articles">; headerElement?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "h7"; -} +}; -const { title, date, url, content, headerElement = "h2" } = Astro.props; +const { + article: { + id, + data: { title, date }, + }, + headerElement = "h2", +} = Astro.props; const H = headerElement; --- <section class="article-preview"> - <span class="date">{date}</span> - <H class="title"><a href={url}>{title}</a></H> - <p class="content"> - {content} - </p> + <span class="date">{date.toLocaleString()}</span> + <H class="title"><a href={id}>{title}</a></H> + <p class="content">aaa</p> <p>... <a class="mono-link" href="{{ .link }}">Read more</a></p> </section> |
