astro-awesomeness 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,37 @@
1
+ ---
2
+ import type { Post } from "../content/index";
3
+
4
+ import BaseLayout from "./base-layout.astro";
5
+ import PostCard from "../astro/post-card.astro";
6
+ import Pagination from "../astro/pagination.astro";
7
+
8
+ type Props = {
9
+ title: string;
10
+ description: string;
11
+ posts: Array<{ id: string; data: Post }>;
12
+ page?: { currentPage: number; lastPage: number; url: { prev?: string; next?: string } };
13
+ urlForPage?: (page: number) => string;
14
+ locale?: string;
15
+ siteTitle?: string;
16
+ };
17
+
18
+ const { title, description, posts, page, urlForPage, locale, siteTitle } = Astro.props;
19
+ ---
20
+ <BaseLayout title={title} description={description} siteTitle={siteTitle}>
21
+ <main class="mx-auto max-w-3xl px-4 py-10">
22
+ <header class="mb-8">
23
+ <h1 class="text-foreground text-3xl font-bold tracking-tight">{title}</h1>
24
+ <p class="text-muted-foreground mt-2">{description}</p>
25
+ </header>
26
+ <section>
27
+ {posts.map((post) => <PostCard post={post} locale={locale} />)}
28
+ </section>
29
+ {page && urlForPage && (
30
+ <Pagination
31
+ currentPage={page.currentPage}
32
+ lastPage={page.lastPage}
33
+ urlForPage={urlForPage}
34
+ />
35
+ )}
36
+ </main>
37
+ </BaseLayout>
@@ -0,0 +1,41 @@
1
+ ---
2
+ import type { Post } from "../content/index";
3
+
4
+ import BaseLayout from "./base-layout.astro";
5
+ import FormattedDate from "../astro/formatted-date.astro";
6
+ import ReadingTime from "../astro/reading-time.astro";
7
+ import TagList from "../astro/tag-list.astro";
8
+ import Prose from "../astro/prose.astro";
9
+
10
+ type Props = {
11
+ post: { id: string; data: Post; body?: string };
12
+ locale?: string;
13
+ siteTitle?: string;
14
+ };
15
+
16
+ const { post, locale, siteTitle } = Astro.props;
17
+ const { title, description, pubDate, updatedDate, tags } = post.data;
18
+ ---
19
+ <BaseLayout title={title} description={description} type="article" siteTitle={siteTitle}>
20
+ <article class="mx-auto max-w-3xl px-4 py-10">
21
+ <header class="mb-8">
22
+ <h1 class="text-foreground text-3xl font-bold tracking-tight sm:text-4xl">{title}</h1>
23
+ <div class="text-muted-foreground mt-3 flex flex-wrap items-center gap-x-3 gap-y-1 text-sm">
24
+ <FormattedDate date={pubDate} locale={locale} />
25
+ <span aria-hidden="true">·</span>
26
+ <ReadingTime text={post.body ?? ""} />
27
+ {updatedDate && (
28
+ <>
29
+ <span aria-hidden="true">·</span>
30
+ <span>Updated <FormattedDate date={updatedDate} locale={locale} /></span>
31
+ </>
32
+ )}
33
+ </div>
34
+ {tags.length > 0 && <TagList tags={tags} class="mt-4" />}
35
+ </header>
36
+
37
+ <Prose>
38
+ <slot />
39
+ </Prose>
40
+ </article>
41
+ </BaseLayout>