feat: add thumbhashes to images closes #6

This commit is contained in:
2023-08-11 16:13:20 +02:00
parent 6dd8575b15
commit 0acbbd6905
22 changed files with 489 additions and 51 deletions

View File

@@ -2,15 +2,15 @@ import { isYoutubeLink } from "@lib/string.ts";
import { IconBrandYoutube } from "@components/icons.tsx";
export function Card(
{ link, title, image, backgroundSize = 100 }: {
{ link, title, image, thumbnail, backgroundSize = 100 }: {
backgroundSize?: number;
thumbnail?: string;
link?: string;
title?: string;
image?: string;
},
) {
const backgroundStyle = {
backgroundImage: `url(${image})`,
backgroundSize: "cover",
boxShadow: "0px -60px 90px black inset, 0px 10px 20px #fff1 inset",
};
@@ -25,20 +25,32 @@ export function Card(
<a
href={link}
style={backgroundStyle}
class="text-white rounded-3xl shadow-md p-4 relative
data-thumb={thumbnail}
class="text-white rounded-3xl shadow-md relative
lg:w-56 lg:h-56
sm:w-48 sm:h-48
w-[37vw] h-[37vw]"
>
{!image?.includes("placeholder.svg") && false &&
(
<img
class="absolute opacity-30 top-0 left-0 object-cover w-full h-full -z-10"
src={image}
style={{ filter: "blur(30px)" }}
/>
)}
<div class="h-full flex flex-col justify-between relative z-10">
{true && (
<img
class="absolute rounded-3xl top-0 left-0 object-cover w-full h-full"
data-thumb-img
loading="lazy"
src={image || "/placeholder.svg"}
/>
)}
<div
class="p-4 flex flex-col justify-between relative z-10"
style={{
outline: "solid 2px #141218",
borderRadius: "1.4rem",
height: "calc(100% + 0.5px)",
width: "calc(100% + 0.5px)",
marginTop: "-0.5px",
marginLeft: "-0.5px",
boxShadow: "0px -60px 90px black inset, 0px 10px 20px #fff1 inset",
}}
>
<div>
{/* Recipe Card content */}
</div>