From fcc2f4704e39b0e69b377cc138f75027721dac22 Mon Sep 17 00:00:00 2001 From: Dawid Rycerz Date: Tue, 22 Jul 2025 15:08:37 +0300 Subject: Initial template --- src/components/widgets/BlogHighlightedPosts.astro | 64 +++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 src/components/widgets/BlogHighlightedPosts.astro (limited to 'src/components/widgets/BlogHighlightedPosts.astro') diff --git a/src/components/widgets/BlogHighlightedPosts.astro b/src/components/widgets/BlogHighlightedPosts.astro new file mode 100644 index 0000000..75f35a9 --- /dev/null +++ b/src/components/widgets/BlogHighlightedPosts.astro @@ -0,0 +1,64 @@ +--- +import { APP_BLOG } from 'astrowind:config'; + +import Grid from '~/components/blog/Grid.astro'; + +import { getBlogPermalink } from '~/utils/permalinks'; +import { findPostsByIds } from '~/utils/blog'; +import WidgetWrapper from '~/components/ui/WidgetWrapper.astro'; +import type { Widget } from '~/types'; + +export interface Props extends Widget { + title?: string; + linkText?: string; + linkUrl?: string | URL; + information?: string; + postIds: string[]; +} + +const { + title = await Astro.slots.render('title'), + linkText = 'View all posts', + linkUrl = getBlogPermalink(), + information = await Astro.slots.render('information'), + postIds = [], + + id, + isDark = false, + classes = {}, + bg = await Astro.slots.render('bg'), +} = Astro.props; + +const posts = APP_BLOG.isEnabled ? await findPostsByIds(postIds) : []; +--- + +{ + APP_BLOG.isEnabled ? ( + +
+ {title && ( +
+

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

+ )} + + {information &&

} +

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