Skip to content

Commit

Permalink
feat: Update image components to use dynamic width and height propert…
Browse files Browse the repository at this point in the history
…ies (#122)

Set the width and height of image components based on module.imageWidth
and module.imageHeight props if available, else use defaults. Update sizes
attribute to ensure responsive images are displayed properly.
  • Loading branch information
nexmoe authored May 5, 2024
1 parent c2971ec commit 8330f16
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion components/module/Gallery.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ const cover = props.module.s3Key ? `https://space.r2.102415.xyz/${props.module.s
:alt="module.title"
referrerpolicy="no-referrer"
loading="lazy"
:width="`500px`"
:width="module.imageWidth || undefined"
:height="module.imageHeight || undefined"
sizes="500px"
/>
<div class="absolute bottom-0 left-0 px-5 pt-5 pb-4 bg-gradient-to-t from-black/35 to-transparent w-full">
<h3 class="drop-shadow-md text-white font-bold text-2xl tracking-tight">
Expand Down
4 changes: 3 additions & 1 deletion components/module/Image.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ const cover = props.module.s3Key ? `https://space.r2.102415.xyz/${props.module.s
:alt="module.title"
referrerpolicy="no-referrer"
loading="lazy"
:width="`400px`"
:width="module.imageWidth || undefined"
:height="module.imageHeight || undefined"
sizes="500px"
/>
</div>
</div>
Expand Down

0 comments on commit 8330f16

Please sign in to comment.