feat: add some icon
Some checks failed
Deploy to SFTP Server / build (push) Failing after 1h16m9s

This commit is contained in:
max_richter 2024-04-07 03:23:50 +02:00
parent ff1188b4b2
commit 5b11664a3f
5 changed files with 14 additions and 63 deletions

BIN
public/projects/karl/favicon.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -19,7 +19,6 @@
_img.addEventListener("load", () => { _img.addEventListener("load", () => {
img.classList.remove("thumb-loading"); img.classList.remove("thumb-loading");
_img.style.opacity = "1"; _img.style.opacity = "1";
console.log("loaded");
}); });
if (_img?.alt) altText = _img.alt; if (_img?.alt) altText = _img.alt;
else altText = ""; else altText = "";
@ -128,6 +127,10 @@
display: none; display: none;
} }
.images :global(.thumb-loading)::before {
opacity: 0;
}
.images :global(.active) { .images :global(.active) {
position: relative; position: relative;
display: block !important; display: block !important;

View File

@ -1,55 +0,0 @@
<script>
import { thumbHashToRGBA, rgbaToDataURL } from "thumbhash";
function show(img: HTMLImageElement) {
img.style.opacity = "1";
img.style.filter = "blur(0px)";
setTimeout(() => {
if (img.parentNode) {
(img.parentNode as HTMLPictureElement).style.background = "";
}
}, 600);
}
console.log("Thumbhash script loaded");
document.querySelectorAll("[data-thumbhash]").forEach((entry) => {
const parent = entry?.parentNode as HTMLPictureElement;
const img = entry as HTMLImageElement;
if (parent?.nodeName !== "PICTURE") return;
const hash = img.getAttribute("data-thumbhash");
if (!hash) return;
// its only browser, why you have to be mad
const decodedString = window.atob(hash);
// Create Uint8Array from decoded string
const buffer = new Uint8Array(decodedString.length);
for (let i = 0; i < decodedString.length; i++) {
buffer[i] = decodedString.charCodeAt(i);
}
const image = thumbHashToRGBA(buffer);
const dataURL = rgbaToDataURL(image.w, image.h, image.rgba);
parent.style.background = `url(${dataURL})`;
parent.style.backgroundSize = "cover";
if (img.complete) {
return;
}
img.style.opacity = "0";
img.style.filter = "blur(5px)";
img.style.transition = "opacity 0.6s ease, filter 0.8s ease";
const sources = parent.querySelectorAll("source");
img.onload = () => show(img);
for (const source of sources) {
source.addEventListener("load", () => show(img));
}
});
</script>

View File

@ -5,6 +5,7 @@ cover: ./images/Indicatrices_of_Distortion.png
license: "CC-BY-SA:4.0" license: "CC-BY-SA:4.0"
featured: true featured: true
toc: true toc: true
icon: /projects/karl/favicon.png
links: links:
[ [
["live", "https://max-richter.dev/karl"], ["live", "https://max-richter.dev/karl"],

View File

@ -2,6 +2,8 @@
import Layout from "@layouts/Layout.astro"; import Layout from "@layouts/Layout.astro";
import { getCollection } from "astro:content"; import { getCollection } from "astro:content";
import { useTranslatedPath } from "@i18n/utils"; import { useTranslatedPath } from "@i18n/utils";
import SmallCard from "@components/SmallCard.astro";
import SmallGrid from "@components/SmallGrid.astro";
const collections = ["blog", "photos", "projects"] as const; const collections = ["blog", "photos", "projects"] as const;
@ -48,18 +50,15 @@ const posts = allPosts.filter((post) => {
<Layout title="Max Richter"> <Layout title="Max Richter">
<article> <article>
<h1>Tags</h1> <h1>Tag: {tag}</h1>
{posts.length} <SmallGrid>
<div class="flex flex-col gap-2">
{ {
posts.map((post) => { posts.map((post) => {
return ( return (
<a href={tp("/" + post.collection + "/" + post.slug)}> <SmallCard post={post} />
{post.slug}
</a>
); );
}) })
} }
</div> </SmallGrid>
</article> </article>
</Layout> </Layout>