feat: add picos de europa post
This commit is contained in:
@@ -16,6 +16,7 @@ interface Props {
|
||||
|
||||
async function checkImage(image: ImageMetadata) {
|
||||
const src = image.src;
|
||||
if(!src) return false;
|
||||
try {
|
||||
if (src.startsWith("/@fs") || src.startsWith("/_astro")) return true;
|
||||
const res = await inferRemoteSize(src);
|
||||
@@ -28,6 +29,7 @@ async function checkImage(image: ImageMetadata) {
|
||||
return false;
|
||||
} catch (err) {
|
||||
console.log("Failed to fetch: ", src);
|
||||
console.log(err)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,14 +14,13 @@
|
||||
|
||||
function show(img: HTMLPictureElement) {
|
||||
img.classList.add("active");
|
||||
const _img = img.querySelector("img");
|
||||
const _img = img.querySelector("img") || img;
|
||||
if (!_img) return;
|
||||
_img.addEventListener("load", () => {
|
||||
img.classList.remove("thumb-loading");
|
||||
_img.style.opacity = "1";
|
||||
});
|
||||
if (_img?.alt) altText = _img.alt;
|
||||
else altText = "";
|
||||
altText = _img["alt"] ?? _img.getAttribute("alt") ?? "";
|
||||
height = _img.getBoundingClientRect().height;
|
||||
setTimeout(() => {
|
||||
height = _img.getBoundingClientRect().height;
|
||||
@@ -58,25 +57,21 @@
|
||||
class:title
|
||||
class:not-loaded={!loaded}
|
||||
class:loaded
|
||||
style={`--height:${height}px`}
|
||||
>
|
||||
style={`--height:${height}px`}>
|
||||
{#if title}
|
||||
<div class="flex items-center p-x-4 p-y-6 bg justify-between">
|
||||
<h3>{title}</h3>
|
||||
|
||||
<div
|
||||
class="overflow-hidden rounded-md bg-light gap-2 flex p-2 border border-light"
|
||||
>
|
||||
class="overflow-hidden rounded-md bg-light gap-2 flex p-2 border border-light">
|
||||
<button
|
||||
class="flex-1 i-tabler-arrow-left"
|
||||
aria-label="previous image"
|
||||
on:click={() => setIndex(index - 1)}
|
||||
/>
|
||||
on:click={() => setIndex(index - 1)} />
|
||||
<button
|
||||
class="flex-1 i-tabler-arrow-right"
|
||||
aria-label="next image"
|
||||
on:click={() => setIndex(index + 1)}
|
||||
/>
|
||||
on:click={() => setIndex(index + 1)} />
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
Reference in New Issue
Block a user