89 lines
2.4 KiB
TypeScript
89 lines
2.4 KiB
TypeScript
import Image from "$/uwil/Image";
|
|
import Button from "$/uwil/Button";
|
|
import { bgColors, fonts, imageShapes, simpleWeights } from "@/front/lib/constants";
|
|
import { cn } from "@/lib/utils";
|
|
import { ThemeItemCardProps } from "@/types/front";
|
|
|
|
export default function ItemCard({
|
|
button,
|
|
title,
|
|
image,
|
|
description,
|
|
variant,
|
|
size,
|
|
subtitle,
|
|
shape = imageShapes.ROUNDED
|
|
}: ThemeItemCardProps) {
|
|
const width = size && size.width ? size.width : "w-[97%] md:w-72 lg:w-72";
|
|
const height = size && size.height ? size.height : "aspect-square";
|
|
|
|
const titleFont = title?.font ?? fonts.DELIUS_SWASH;
|
|
const titleWeight = title?.weight ?? simpleWeights.NORMAL;
|
|
|
|
const descriptionFont = description?.font ?? fonts.GOTHAM;
|
|
const descriptionWeight = description?.weight ?? simpleWeights.NORMAL;
|
|
|
|
const btnVariant = variant === bgColors.PRIMARY ? "inverted" : "default";
|
|
|
|
return (
|
|
<div
|
|
className={`flex flex-col items-center justify-center ${width} inline-block`}
|
|
>
|
|
<Image
|
|
size={`${width} ${height}`}
|
|
image={image}
|
|
shape={shape}
|
|
action={
|
|
button
|
|
? {
|
|
href: button.href,
|
|
label: button.label,
|
|
}
|
|
: undefined
|
|
}
|
|
/>
|
|
|
|
<div className="w-full mt-6 text-center px-10 md:px-0">
|
|
{title?.text && (
|
|
<h4 className={cn("text-3xl md:text-3xl", titleFont, titleWeight)}>
|
|
{title.text}
|
|
</h4>
|
|
)}
|
|
{subtitle?.text && (
|
|
<h5
|
|
className={cn(
|
|
"text-2xl",
|
|
subtitle?.font ?? fonts.DELIUS_SWASH,
|
|
subtitle?.weight ?? "font-normal",
|
|
)}
|
|
>
|
|
{subtitle.text}
|
|
</h5>
|
|
)}
|
|
{description?.text && (
|
|
<p
|
|
// eslint-disable-next-line react/no-danger
|
|
dangerouslySetInnerHTML={{
|
|
__html: description.text,
|
|
}}
|
|
className={cn(descriptionFont, descriptionWeight, "pt-4")}
|
|
/>
|
|
)}
|
|
{button?.href && button?.label && (
|
|
<Button
|
|
variant={btnVariant}
|
|
icon={{
|
|
icon: "chevron-right",
|
|
placement: "right",
|
|
}}
|
|
className="mt-5"
|
|
link={{
|
|
href: button.href,
|
|
label: button.label,
|
|
}}
|
|
/>
|
|
)}
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|