From d981e29ad6c821d2ada03b139b8611bb262cf723 Mon Sep 17 00:00:00 2001 From: prototypa Date: Wed, 31 Aug 2022 17:21:30 -0400 Subject: [PATCH] Add tags component in posts --- src/components/widgets/BlogListItem.astro | 8 ++++++-- src/components/widgets/BlogPost.astro | 9 ++++++--- src/components/widgets/PostTags.astro | 12 ++++++++++++ 3 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 src/components/widgets/PostTags.astro diff --git a/src/components/widgets/BlogListItem.astro b/src/components/widgets/BlogListItem.astro index cca1f1c..5cbaa3c 100644 --- a/src/components/widgets/BlogListItem.astro +++ b/src/components/widgets/BlogListItem.astro @@ -3,6 +3,7 @@ import Picture from "~/components/core/Picture.astro"; import { getPermalink } from "~/utils/permalinks"; import { findImage } from "~/utils/findImage"; import { getFormattedDate } from "~/utils/getFormatedDate"; +import PostTags from "./PostTags.astro"; const { post } = Astro.props; @@ -19,7 +20,7 @@ const image = await findImage(post.image);
-

+

{post.title} @@ -29,12 +30,15 @@ const image = await findImage(post.image);

{post.excerpt || post.description}

-
+
~ {Math.ceil(post.readingTime)} min read
+
+ +

\ No newline at end of file diff --git a/src/components/widgets/BlogPost.astro b/src/components/widgets/BlogPost.astro index 24a6659..ef52e85 100644 --- a/src/components/widgets/BlogPost.astro +++ b/src/components/widgets/BlogPost.astro @@ -1,6 +1,7 @@ --- import Picture from "~/components/core/Picture.astro"; import { getFormattedDate } from "~/utils/getFormatedDate"; +import PostTags from "~/components/widgets/PostTags.astro"; const { post } = Astro.props; --- @@ -12,10 +13,9 @@ const { post } = Astro.props; ~ {Math.ceil(post.readingTime)} min read

+ class="px-4 sm:px-6 max-w-3xl mx-auto text-center text-4xl md:text-5xl font-bold leading-tighter tracking-tighter mb-8 font-heading"> {post.title}

- { post.image && (
+ class="container mx-auto px-8 sm:px-6 max-w-3xl prose prose-lg lg:prose-xl dark:prose-invert dark:prose-headings:text-slate-300 prose-md prose-headings:font-heading prose-headings:leading-tighter prose-headings:tracking-tighter prose-headings:font-bold prose-a:text-blue-600 dark:prose-a:text-blue-400 prose-img:rounded-md prose-img:shadow-lg mt-8">
+
+ +
\ No newline at end of file diff --git a/src/components/widgets/PostTags.astro b/src/components/widgets/PostTags.astro new file mode 100644 index 0000000..32c9c02 --- /dev/null +++ b/src/components/widgets/PostTags.astro @@ -0,0 +1,12 @@ +--- +import { getPermalink } from "~/utils/permalinks"; +const { tags } = Astro.props; +--- + +{tags && Array.isArray(tags) &&
+} \ No newline at end of file