feat: refactor whole bunch of stuff
This commit is contained in:
@@ -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, "")}`}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user