coyotte508's picture
coyotte508 HF staff
πŸ’„ Better UI for e-shop
34660c6
raw
history blame
1.37 kB
<script lang="ts">
import Container from '$lib/components/Container.svelte';
import Picture from '$lib/components/Picture.svelte';
import Masonry from '$lib/components/Masonry.svelte';
import type { PageData } from './$types';
export let data: PageData;
const pictures = data.pictures.map((p) => ({ ...p, loaded: false }));
</script>
<Container class="my-4">
<h1 class="text-4xl text-oxford mb-3">Tissus et finitions</h1>
<Masonry>
{#each pictures as picture}
<a
href="/photos/raw/{picture.storage[0]._id}"
class="relative picture-link"
data-title={picture.name}
>
<Picture
minStorage={1}
{picture}
class="max-w-full {picture.loaded ? 'loaded' : ''}"
loading="lazy"
/>
</a>
{/each}
</Masonry>
</Container>
<style>
.picture-link {
overflow: hidden;
}
.picture-link::after {
position: absolute;
content: attr(data-title);
text-align: center;
left: 0;
right: 0;
bottom: 1rem;
color: white;
text-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);
font-size: 2rem;
opacity: 0.4;
transition-duration: 400ms;
}
:global(.picture-link img) {
transition-duration: 400ms;
transform: scale(0);
}
:global(.picture-link img.loaded) {
transform: scale(1);
}
:global(.picture-link:hover img.loaded) {
transform: scale(1.2);
}
.picture-link:hover::after {
opacity: 1;
}
</style>