fix: some design layouts
All checks were successful
Deploy to SFTP Server / build (push) Successful in 4m32s
All checks were successful
Deploy to SFTP Server / build (push) Successful in 4m32s
This commit is contained in:
parent
e68f433f1e
commit
57ef1426ee
@ -2,8 +2,18 @@
|
|||||||
import { onMount } from "svelte";
|
import { onMount } from "svelte";
|
||||||
import { fade } from "svelte/transition";
|
import { fade } from "svelte/transition";
|
||||||
import normalizeWheel from "@helpers/normalizeWheel";
|
import normalizeWheel from "@helpers/normalizeWheel";
|
||||||
let images = [];
|
type Image = {
|
||||||
let progress = [];
|
exif: string[];
|
||||||
|
src: string;
|
||||||
|
alt: string;
|
||||||
|
sizes: string;
|
||||||
|
original: string;
|
||||||
|
loaded: string;
|
||||||
|
originalLoaded: boolean;
|
||||||
|
startedLoading: boolean;
|
||||||
|
};
|
||||||
|
let images: Image[] = [];
|
||||||
|
let progress: number[] = [];
|
||||||
let currentIndex = -1;
|
let currentIndex = -1;
|
||||||
const maxZoom = 5;
|
const maxZoom = 5;
|
||||||
import { swipe } from "svelte-gestures";
|
import { swipe } from "svelte-gestures";
|
||||||
@ -34,14 +44,14 @@
|
|||||||
currentIndex = index;
|
currentIndex = index;
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleKeyDown = ({ key }) => {
|
const handleKeyDown = ({ key }: KeyboardEvent) => {
|
||||||
if (currentIndex < 0) return;
|
if (currentIndex < 0) return;
|
||||||
if (key === "Escape" && currentIndex > -1) setIndex(-1);
|
if (key === "Escape" && currentIndex > -1) setIndex(-1);
|
||||||
if (key === "ArrowLeft") addIndex(-1);
|
if (key === "ArrowLeft") addIndex(-1);
|
||||||
if (key === "ArrowRight") addIndex(+1);
|
if (key === "ArrowRight") addIndex(+1);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleOriginalLoading = async (image) => {
|
const handleOriginalLoading = async (image: Image) => {
|
||||||
if (!image.startedLoading) {
|
if (!image.startedLoading) {
|
||||||
image.startedLoading = true;
|
image.startedLoading = true;
|
||||||
let cIndex = currentIndex;
|
let cIndex = currentIndex;
|
||||||
@ -54,7 +64,8 @@
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
const total = Number(response.headers.get("content-length"));
|
const total = Number(response.headers.get("content-length"));
|
||||||
const reader = response.body.getReader();
|
const reader = response?.body?.getReader();
|
||||||
|
if (!reader) return;
|
||||||
let bytesReceived = 0;
|
let bytesReceived = 0;
|
||||||
let chunks = [];
|
let chunks = [];
|
||||||
console.log("[SLIDER] started loading " + image.original);
|
console.log("[SLIDER] started loading " + image.original);
|
||||||
@ -145,7 +156,7 @@
|
|||||||
console.log("Error loading", image);
|
console.log("Error loading", image);
|
||||||
});
|
});
|
||||||
|
|
||||||
let exif = [];
|
let exif: string[] = [];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const rawExif = image.getAttribute("data-exif");
|
const rawExif = image.getAttribute("data-exif");
|
||||||
@ -166,7 +177,8 @@
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
exif,
|
exif,
|
||||||
// preview: preview.getAttribute("src"),
|
startedLoading: false,
|
||||||
|
loaded: "",
|
||||||
src: image.getAttribute("srcset"),
|
src: image.getAttribute("srcset"),
|
||||||
alt: image.getAttribute("alt"),
|
alt: image.getAttribute("alt"),
|
||||||
sizes: image.getAttribute("sizes"),
|
sizes: image.getAttribute("sizes"),
|
||||||
@ -210,6 +222,7 @@
|
|||||||
<div
|
<div
|
||||||
class="image"
|
class="image"
|
||||||
use:swipe
|
use:swipe
|
||||||
|
role="dialog"
|
||||||
on:swipe={handleSwipe}
|
on:swipe={handleSwipe}
|
||||||
on:wheel|passive={handleScroll}
|
on:wheel|passive={handleScroll}
|
||||||
on:mousemove={handleMouseMove}
|
on:mousemove={handleMouseMove}
|
||||||
@ -221,11 +234,6 @@
|
|||||||
style={`transform: scaleX(${progress[currentIndex]});`} />
|
style={`transform: scaleX(${progress[currentIndex]});`} />
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<img
|
|
||||||
class="background"
|
|
||||||
src={images[currentIndex].preview}
|
|
||||||
alt="background blur" />
|
|
||||||
|
|
||||||
<span>
|
<span>
|
||||||
<img
|
<img
|
||||||
style={`transform: scale(${scale}); transform-origin: ${
|
style={`transform: scale(${scale}); transform-origin: ${
|
||||||
@ -239,7 +247,9 @@
|
|||||||
{#if images[currentIndex].exif}
|
{#if images[currentIndex].exif}
|
||||||
{@const exif = images[currentIndex].exif}
|
{@const exif = images[currentIndex].exif}
|
||||||
<div class="exif">
|
<div class="exif">
|
||||||
{exif.join(" | ")}
|
{#each exif as e}
|
||||||
|
<span> {e} </span>
|
||||||
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
@ -252,7 +262,7 @@
|
|||||||
height: 10px;
|
height: 10px;
|
||||||
z-index: 99;
|
z-index: 99;
|
||||||
left: 47px;
|
left: 47px;
|
||||||
background-color: black;
|
background: var(--neutral-800);
|
||||||
width: calc(100% - 94px);
|
width: calc(100% - 94px);
|
||||||
transform-origin: left;
|
transform-origin: left;
|
||||||
transition: transform 0.3s ease;
|
transition: transform 0.3s ease;
|
||||||
@ -264,7 +274,7 @@
|
|||||||
left: 0;
|
left: 0;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
background-color: rgba(24, 24, 24, 0.99);
|
background: var(--neutral-800);
|
||||||
|
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
transition: opacity 0.1s ease;
|
transition: opacity 0.1s ease;
|
||||||
@ -304,21 +314,11 @@
|
|||||||
transform-origin 0.1s linear;
|
transform-origin 0.1s linear;
|
||||||
}
|
}
|
||||||
|
|
||||||
.image > .background {
|
|
||||||
filter: brightness(0.2);
|
|
||||||
position: absolute;
|
|
||||||
opacity: 0.3;
|
|
||||||
width: 100%;
|
|
||||||
z-index: 98;
|
|
||||||
height: 100%;
|
|
||||||
object-fit: fill;
|
|
||||||
}
|
|
||||||
|
|
||||||
.controls {
|
.controls {
|
||||||
width: fit-content;
|
width: fit-content;
|
||||||
left: 50vw;
|
left: 50vw;
|
||||||
transform: translateX(-50%);
|
transform: translateX(-50%);
|
||||||
background: black;
|
background: var(--neutral-800);
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 99;
|
z-index: 99;
|
||||||
@ -329,7 +329,7 @@
|
|||||||
width: 15px;
|
width: 15px;
|
||||||
height: 15px;
|
height: 15px;
|
||||||
border-style: none;
|
border-style: none;
|
||||||
background: black;
|
background: transparent;
|
||||||
border: solid 1px white;
|
border: solid 1px white;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
margin: 2px;
|
margin: 2px;
|
||||||
@ -346,15 +346,25 @@
|
|||||||
left: 50vw;
|
left: 50vw;
|
||||||
transform: translateX(-50%);
|
transform: translateX(-50%);
|
||||||
z-index: 99;
|
z-index: 99;
|
||||||
background-color: black;
|
background: var(--neutral-800);
|
||||||
color: white;
|
color: white;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
font-size: 0.8em;
|
padding-inline: 10px;
|
||||||
|
font-size: 0.9em;
|
||||||
white-space: pre;
|
white-space: pre;
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.exif > span {
|
||||||
|
padding: 0px 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.exif > span:last-child {
|
||||||
|
border-right: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.gallery-wrapper > button {
|
.gallery-wrapper > button {
|
||||||
background: black;
|
background: var(--neutral-800);
|
||||||
color: white;
|
color: white;
|
||||||
border-radius: 0px;
|
border-radius: 0px;
|
||||||
border: none;
|
border: none;
|
||||||
|
@ -12,6 +12,7 @@ const t = useTranslations(Astro.url);
|
|||||||
.arrow {
|
.arrow {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 0;
|
left: 0;
|
||||||
|
z-index: 1;
|
||||||
transform: translateX(-110%) translateY(-160px);
|
transform: translateX(-110%) translateY(-160px);
|
||||||
}
|
}
|
||||||
.arrow > p {
|
.arrow > p {
|
||||||
|
@ -120,7 +120,7 @@ import "./global.css";
|
|||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body class="text-neutral flex flex-col">
|
<body class="text-neutral flex flex-col">
|
||||||
<header class="sticky bottom-0 sm:top-0 z-2 order-last sm:order-first">
|
<header class="sticky top-0 z-2">
|
||||||
<Nav />
|
<Nav />
|
||||||
</header>
|
</header>
|
||||||
<main id="main-content" class="relative flex flex-col gap-6">
|
<main id="main-content" class="relative flex flex-col gap-6">
|
||||||
|
Loading…
Reference in New Issue
Block a user