diff options
| author | Dawid Rycerz <dawid@rycerz.xyz> | 2025-07-03 14:31:38 +0300 |
|---|---|---|
| committer | Dawid Rycerz <dawid@rycerz.xyz> | 2025-07-03 14:31:38 +0300 |
| commit | 0b6a5881b99027be9a175e7d1f2b112daef1ab51 (patch) | |
| tree | 5c00a2893e07e562aee15b87382bf7322494e484 /src/components/note/Note.astro | |
| parent | e28e2c961659f48177cf8ce39eeb39480b221535 (diff) | |
Add images support
Diffstat (limited to 'src/components/note/Note.astro')
| -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" /> |
