2026-04-06 17:53:40 +02:00
|
|
|
<script lang="ts">
|
|
|
|
|
|
|
|
|
|
export interface GalleryImage {
|
|
|
|
|
src: string;
|
|
|
|
|
alt: string;
|
2026-04-06 20:20:56 +02:00
|
|
|
desc: string[];
|
2026-04-06 17:53:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let {
|
|
|
|
|
images,
|
|
|
|
|
}: {
|
|
|
|
|
images: GalleryImage[];
|
|
|
|
|
} = $props();
|
|
|
|
|
|
|
|
|
|
let currentIndex: number = $state(0);
|
|
|
|
|
|
|
|
|
|
function galleryBack() {
|
|
|
|
|
if (currentIndex == 0) {
|
|
|
|
|
currentIndex = images.length - 1;
|
|
|
|
|
} else {
|
|
|
|
|
currentIndex -= 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function galleryForward() {
|
|
|
|
|
if (currentIndex == images.length - 1) {
|
|
|
|
|
currentIndex = 0;
|
|
|
|
|
} else {
|
|
|
|
|
currentIndex += 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
2026-04-06 21:13:29 +02:00
|
|
|
<div class="gallery-zone">
|
|
|
|
|
<div class="gallery-container blurred-background">
|
|
|
|
|
<div class="gallery-button-container">
|
2026-04-07 08:35:55 +02:00
|
|
|
<button class="gallery-button" onclick={galleryBack}>↫</button>
|
2026-04-06 21:13:29 +02:00
|
|
|
<div class="gallery-text-container">
|
2026-04-07 08:35:55 +02:00
|
|
|
<p class="gallery-index">{currentIndex + 1} / {images.length} :: <a href={images[currentIndex].src}>full-size</a></p>
|
2026-04-06 21:13:29 +02:00
|
|
|
<div class="gallery-desc-container">
|
|
|
|
|
<p> </p> <!-- this element intentionally left blank -->
|
|
|
|
|
{#each images[currentIndex].desc as d}
|
|
|
|
|
<p>{@html d}</p>
|
|
|
|
|
{/each}
|
|
|
|
|
</div>
|
2026-04-06 20:20:56 +02:00
|
|
|
</div>
|
2026-04-07 08:35:55 +02:00
|
|
|
<button class="gallery-button" onclick={galleryForward}>↬</button>
|
2026-04-06 21:13:29 +02:00
|
|
|
</div>
|
|
|
|
|
<div class="gallery-img-container">
|
|
|
|
|
<img class="gallery-img" loading="lazy" src={images[currentIndex].src} alt={images[currentIndex].alt}>
|
2026-04-06 19:23:22 +02:00
|
|
|
</div>
|
2026-04-06 17:53:40 +02:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<style>
|
2026-04-06 21:13:29 +02:00
|
|
|
.gallery-zone {
|
|
|
|
|
width: 100%;
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-06 17:53:40 +02:00
|
|
|
.gallery-container {
|
|
|
|
|
max-width: var(--media-width);
|
2026-04-06 19:23:22 +02:00
|
|
|
margin: 12px auto;
|
|
|
|
|
border: var(--border-style) var(--border-dash-size) var(--color-highlight-alt);
|
|
|
|
|
border-radius: var(--border-radius);
|
2026-04-07 08:35:55 +02:00
|
|
|
overflow: hidden;
|
2026-04-06 19:23:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.gallery-img-container {
|
2026-04-07 08:35:55 +02:00
|
|
|
width: 100%;
|
|
|
|
|
height: var(--media-height);
|
2026-04-06 17:53:40 +02:00
|
|
|
margin: 0 auto;
|
2026-04-07 08:35:55 +02:00
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
2026-04-06 17:53:40 +02:00
|
|
|
}
|
|
|
|
|
|
2026-04-06 19:23:22 +02:00
|
|
|
.gallery-img {
|
2026-04-06 17:53:40 +02:00
|
|
|
object-fit: contain;
|
2026-04-06 19:23:22 +02:00
|
|
|
margin: 0;
|
2026-04-07 08:35:55 +02:00
|
|
|
width: 100%;
|
2026-04-06 19:23:22 +02:00
|
|
|
filter: brightness(100%) saturate(100%);
|
|
|
|
|
transition: filter var(--duration-animation) var(--anim-curve);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.gallery-button-container,
|
|
|
|
|
.gallery-text-container {
|
|
|
|
|
opacity: 0%;
|
|
|
|
|
transition: opacity var(--duration-animation) var(--anim-curve);
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-06 21:13:29 +02:00
|
|
|
.gallery-zone:hover .gallery-button-container,
|
|
|
|
|
.gallery-zone:hover .gallery-text-container
|
2026-04-06 19:23:22 +02:00
|
|
|
{
|
|
|
|
|
opacity: 100%;
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-06 21:13:29 +02:00
|
|
|
.gallery-zone:hover .gallery-img {
|
2026-04-06 21:09:56 +02:00
|
|
|
filter: brightness(40%) saturate(60%);
|
2026-04-06 19:23:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.gallery-text-container {
|
|
|
|
|
height: 100%;
|
|
|
|
|
width: 100%;
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
margin: 8px 32px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.gallery-index {
|
|
|
|
|
font-family: var(--font-mono);
|
|
|
|
|
font-weight: 600;
|
2026-04-07 08:35:55 +02:00
|
|
|
font-size: 1.0rem;
|
2026-04-06 19:23:22 +02:00
|
|
|
}
|
|
|
|
|
|
2026-04-07 08:35:55 +02:00
|
|
|
.gallery-text-container p, .gallery-index a {
|
2026-04-06 19:23:22 +02:00
|
|
|
height: fit-content;
|
|
|
|
|
font-size: 1.0rem;
|
|
|
|
|
line-height: 1.4rem;
|
2026-04-07 08:35:55 +02:00
|
|
|
text-shadow: 0 0 6px black;
|
2026-04-06 20:20:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.gallery-desc-container {
|
2026-04-06 20:36:01 +02:00
|
|
|
padding-bottom: 12px;
|
2026-04-06 20:20:56 +02:00
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
gap: 4px;
|
|
|
|
|
}
|
|
|
|
|
.gallery-desc-container p {
|
|
|
|
|
margin: 0;
|
2026-04-06 17:53:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.gallery-button-container {
|
2026-04-06 19:23:22 +02:00
|
|
|
z-index: 1;
|
2026-04-06 17:53:40 +02:00
|
|
|
position: absolute;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
align-items: center;
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
}
|
2026-04-06 19:23:22 +02:00
|
|
|
|
|
|
|
|
.gallery-button {
|
|
|
|
|
color: var(--color-text);
|
|
|
|
|
/* background-color: var(--color-background-highlight-alt); */
|
2026-04-06 17:53:40 +02:00
|
|
|
height: fit-content;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
font-size: 2.4rem;
|
|
|
|
|
line-height: 2.4rem;
|
2026-04-07 08:35:55 +02:00
|
|
|
padding: 8px 12px;
|
2026-04-06 19:23:22 +02:00
|
|
|
|
|
|
|
|
border-top: var(--border-style) var(--border-dash-size) var(--color-highlight-alt);
|
|
|
|
|
border-bottom: var(--border-style) var(--border-dash-size) var(--color-highlight-alt);
|
|
|
|
|
|
|
|
|
|
transition: background-color var(--duration-animation) var(--anim-curve);
|
|
|
|
|
}
|
|
|
|
|
.gallery-button:first-child {
|
|
|
|
|
border-top-right-radius: var(--border-radius);
|
|
|
|
|
border-bottom-right-radius: var(--border-radius);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
.gallery-button:last-child {
|
|
|
|
|
border-top-left-radius: var(--border-radius);
|
|
|
|
|
border-bottom-left-radius: var(--border-radius);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.gallery-button:hover {
|
2026-04-07 08:35:55 +02:00
|
|
|
background-color: var(--color-background-highlight-hover-alt);
|
2026-04-06 17:53:40 +02:00
|
|
|
}
|
|
|
|
|
</style>
|