diff options
Diffstat (limited to 'src/components/note')
| -rw-r--r-- | src/components/note/Note.astro | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/components/note/Note.astro b/src/components/note/Note.astro index a8cf205..3017d2d 100644 --- a/src/components/note/Note.astro +++ b/src/components/note/Note.astro @@ -45,6 +45,27 @@ const { Content } = await render(note); > <Content /> { + !isPreview && note.data.attachments && note.data.attachments.length > 0 && ( + <div class="mt-6 grid grid-cols-1 gap-4 sm:grid-cols-2"> + {note.data.attachments.map((attachment: { url: string; type: string }) => ( + <a + href={attachment.url} + target="_blank" + rel="noopener noreferrer" + class="block overflow-hidden rounded-lg border border-gray-200 transition-colors hover:border-gray-300 dark:border-gray-700 dark:hover:border-gray-600" + > + <img + src={attachment.url} + alt="Attachment" + class="h-48 w-full object-cover" + loading="lazy" + /> + </a> + ))} + </div> + ) + } + { !isPreview && note.data.sourceUrl && ( <> <hr class="mt-6 mb-4 border-t border-gray-300 dark:border-gray-600" /> |
