import { isYoutubeLink } from "@lib/string.ts"; import { IconBrandYoutube } from "@components/icons.tsx"; import { GenericResource } from "@lib/types.ts"; import { SmallRating } from "@components/Rating.tsx"; import { Link } from "@islands/Link.tsx"; export function Card( { link, rating, title, image, thumbnail, backgroundColor, backgroundSize = 100, }: { backgroundSize?: number; backgroundColor?: string; thumbnail?: string; link?: string; title?: string; image?: string; rating?: number; }, ) { const backgroundStyle: preact.JSX.CSSProperties = { backgroundSize: "cover", backgroundColor: backgroundColor, }; if (backgroundSize !== 100) { backgroundStyle["backgroundSize"] = `${backgroundSize}%`; backgroundStyle["backgroundRepeat"] = "no-repeat"; backgroundStyle["backgroundPosition"] = "center"; } return ( {true && ( )}
{/* Recipe Card content */}
{isYoutubeLink(link || "") && } {title}
{rating !== undefined && (
)}
); } export function ResourceCard( { res, sublink = "movies" }: { sublink?: string; res: GenericResource }, ) { const { meta: { image } = {} } = res || {}; const imageUrl = image ? `/api/images?image=${image}&width=200&height=200` : "/placeholder.svg"; return ( ); }