feat: refactor whole bunch of stuff

This commit is contained in:
Max Richter
2025-11-02 19:03:11 +01:00
parent 81ebc8f5e0
commit e6b90cb785
56 changed files with 753 additions and 360 deletions

View File

@@ -11,13 +11,13 @@ export function Card(
rating,
title,
image,
thumbnail,
thumbhash,
backgroundColor,
backgroundSize = 100,
}: {
backgroundSize?: number;
backgroundColor?: string;
thumbnail?: string;
thumbhash?: string;
link?: string;
title?: string;
image?: string;
@@ -39,22 +39,20 @@ export function Card(
<Link
href={link}
style={backgroundStyle}
data-thumb={thumbnail}
data-thumb={thumbhash}
class="text-white rounded-3xl shadow-md relative
lg:w-56 lg:h-56
sm:w-48 sm:h-48
w-[37vw] h-[37vw]"
>
{true && (
<span class="absolute top-0 left-0 overflow-hidden rounded-3xl w-full h-full">
<img
class="w-full h-full object-cover"
data-thumb-img
loading="lazy"
src={image || "/placeholder.svg"}
/>
</span>
)}
<span class="absolute top-0 left-0 overflow-hidden rounded-3xl w-full h-full">
<img
class="w-full h-full object-cover"
data-thumb-img
loading="lazy"
src={image || "/placeholder.svg"}
/>
</span>
<div
class="p-4 flex flex-col justify-between relative z-10"
style={{
@@ -97,7 +95,7 @@ export function Card(
export function ResourceCard(
{ res, sublink = "movies" }: { sublink?: string; res: GenericResource },
) {
const img = res?.content?.image || res?.content?.cover;
const img = res?.image?.url;
const imageUrl = img
? `/api/images?image=${img}&width=200&height=200`
@@ -105,11 +103,12 @@ export function ResourceCard(
return (
<Card
title={res.content?.name || res.content?.itemReviewed?.name || res.content?.headline ||
title={res.content?.name || res.content?.itemReviewed?.name ||
res.content?.headline ||
res?.name}
backgroundColor={res.meta?.average}
backgroundColor={res.image?.average}
thumbhash={res.image?.blurhash}
rating={parseRating(res.content?.reviewRating?.ratingValue)}
thumbnail={res.cover}
image={imageUrl}
link={`/${sublink}/${res.name.replace(/\.md$/g, "")}`}
/>