From c735556726e75428550a3d28a2cf58e2c8490b7d Mon Sep 17 00:00:00 2001 From: Dawid Rycerz Date: Mon, 21 Jul 2025 21:56:55 +0300 Subject: Initial template --- src/components/widgets/BlogLatestPosts.astro | 63 ++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 src/components/widgets/BlogLatestPosts.astro (limited to 'src/components/widgets/BlogLatestPosts.astro') diff --git a/src/components/widgets/BlogLatestPosts.astro b/src/components/widgets/BlogLatestPosts.astro new file mode 100644 index 0000000..28f66d4 --- /dev/null +++ b/src/components/widgets/BlogLatestPosts.astro @@ -0,0 +1,63 @@ +--- +import { APP_BLOG } from 'astrowind:config'; + +import Grid from '~/components/blog/Grid.astro'; + +import { getBlogPermalink } from '~/utils/permalinks'; +import { findLatestPosts } from '~/utils/blog'; +import WidgetWrapper from '~/components/ui/WidgetWrapper.astro'; +import type { Widget } from '~/types'; +import Button from '~/components/ui/Button.astro'; + +export interface Props extends Widget { + title?: string; + linkText?: string; + linkUrl?: string | URL; + information?: string; + count?: number; +} + +const { + title = await Astro.slots.render('title'), + linkText = 'View all posts', + linkUrl = getBlogPermalink(), + information = await Astro.slots.render('information'), + count = 4, + + id, + isDark = false, + classes = {}, + bg = await Astro.slots.render('bg'), +} = Astro.props; + +const posts = APP_BLOG.isEnabled ? await findLatestPosts({ count }) : []; +--- + +{ + APP_BLOG.isEnabled ? ( + +
+ {title && ( +
+

+ {APP_BLOG.list.isEnabled && linkText && linkUrl && ( + + )} +

+ )} + + {information &&

} +

+ + +
+ ) : ( + + ) +} -- cgit v1.2.3