fix: make design of imag egallery better

This commit is contained in:
Max Richter
2025-10-25 14:37:48 +02:00
parent f1e0654609
commit d62cdc7986
2 changed files with 38 additions and 16 deletions

View File

@@ -218,7 +218,9 @@
{#each images as _, i} {#each images as _, i}
<button <button
aria-label={`Image ${i + 1}`} aria-label={`Image ${i + 1}`}
class="rounded bg-light"
class:active={currentIndex === i} class:active={currentIndex === i}
class:bg-light={currentIndex === i}
on:click={() => { on:click={() => {
currentIndex = i; currentIndex = i;
}}></button> }}></button>
@@ -226,9 +228,24 @@
</div> </div>
{/if} {/if}
<button class="left" on:click={() => addIndex(-1)}>&lt;</button> <button
<button class="right" on:click={() => addIndex(+1)}>&gt;</button> class="left flex-1 bg-light"
<button class="close" on:click={() => setIndex(-1)}>X</button> aria-label="previous image"
on:click={() => addIndex(- 1)}>
<span class="i-tabler-arrow-left" />
</button>
<button
class="right flex-1 bg-light"
aria-label="next image"
on:click={() => addIndex( + 1)}>
<span class="i-tabler-arrow-right" />
</button>
<button
class="close bg-light"
aria-label="close gallery"
on:click={() => setIndex(-1)}>
<span class="i-tabler-x" />
</button>
{#if currentIndex > -1} {#if currentIndex > -1}
<div <div
@@ -278,6 +295,7 @@
transform-origin: left; transform-origin: left;
transition: transform 0.3s ease; transition: transform 0.3s ease;
} }
.gallery-wrapper { .gallery-wrapper {
position: fixed; position: fixed;
z-index: 199; z-index: 199;
@@ -375,27 +393,31 @@
} }
.gallery-wrapper > button { .gallery-wrapper > button {
background: var(--neutral-800); border-radius: 6px;
color: white; padding: 0;
border-radius: 0px;
border: none;
padding: 10px 20px;
position: fixed; position: fixed;
z-index: 200; z-index: 200;
font-size: 1.5rem;
width: 44px;
height: 44px;
display: grid;
place-items: center;
cursor: pointer;
transition: background-color 0.2s;
} }
.close { .close {
top: 0; top: 10px;
right: 0; right: 10px;
} }
.left { .left {
bottom: 0; bottom: 10px;
left: 0; left: 10px;
} }
.right { .right {
bottom: 0; bottom: 10px;
right: 0; right: 10px;
} }
</style> </style>

View File

@@ -67,11 +67,11 @@
<button <button
class="flex-1 i-tabler-arrow-left" class="flex-1 i-tabler-arrow-left"
aria-label="previous image" aria-label="previous image"
on:click={() => setIndex(index - 1)} /> on:click={() => setIndex(index - 1)}></button>
<button <button
class="flex-1 i-tabler-arrow-right" class="flex-1 i-tabler-arrow-right"
aria-label="next image" aria-label="next image"
on:click={() => setIndex(index + 1)} /> on:click={() => setIndex(index + 1)}></button>
</div> </div>
</div> </div>
{/if} {/if}