Load low-res thumbnails

This commit is contained in:
Mikkel Svartveit 2023-10-18 18:28:09 -07:00
parent 0bbf92455f
commit 1b81a7bcf4
3 changed files with 7 additions and 4 deletions

View file

@ -3,16 +3,19 @@ import { Image } from "astro:assets";
interface Props { interface Props {
photo: any; photo: any;
width?: number;
height?: number;
class?: string; class?: string;
} }
const { photo, class: className } = Astro.props; const { photo, width, height, class: className } = Astro.props;
--- ---
<Image <Image
src={photo} src={photo}
alt="" alt=""
height={1000} {width}
{height}
densities={[1, 2]} densities={[1, 2]}
quality="mid" quality="mid"
class={"object-contain rounded " + (className ?? "")} class={"object-contain rounded " + (className ?? "")}

View file

@ -27,6 +27,6 @@ const { photo } = Astro.props;
history.back() history.back()
" "
> >
<Photo photo={photo.default} class="w-auto" /> <Photo photo={photo.default} height={1000} class="w-auto h-full" />
</div> </div>
</RootLayout> </RootLayout>

View file

@ -48,7 +48,7 @@ export const getFileNameFromPath = (path: string) => {
class="flex w-full py-2 duration-100 hover:-translate-y-1 rounded-lg" class="flex w-full py-2 duration-100 hover:-translate-y-1 rounded-lg"
> >
<div class="bg-gray-200 rounded"> <div class="bg-gray-200 rounded">
<Photo photo={photo.default} /> <Photo photo={photo.default} width={400} />
</div> </div>
</a> </a>
)) ))