From 44572badccb2207f24b654a0634a8c6dd338ef71 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Tue, 17 Dec 2024 22:22:04 +0800 Subject: [PATCH] :sparkles: Support more type of attachments --- src/components/AttachmentRenderer.astro | 29 +++++++++++++++++++ src/pages/posts/[...slug].astro | 38 +++++++++++++------------ 2 files changed, 49 insertions(+), 18 deletions(-) create mode 100644 src/components/AttachmentRenderer.astro diff --git a/src/components/AttachmentRenderer.astro b/src/components/AttachmentRenderer.astro new file mode 100644 index 0000000..c136c17 --- /dev/null +++ b/src/components/AttachmentRenderer.astro @@ -0,0 +1,29 @@ +--- +import { getAttachmentUrl } from '../scripts/attachment' + +interface Props { + data: any +} + +const { data: attachment } = Astro.props +--- + +{ + attachment.mimetype.startsWith('image') ? ( + + {attachment.alt} + + ) : attachment.mimetype.startsWith('video') ? ( +