ldc-ovoteam/resources/ts/front/Components/Theme/TripleCol.tsx
2026-08-06 15:09:10 +02:00

78 lines
2.3 KiB
TypeScript

import { ImageProps, TextProps } from "@/types/front";
import Image from "$/uwil/Image";
import { cn } from "@/lib/utils";
import { Separator } from "@/components/ui/separator";
import { BgColorName, bgColors, fonts, ImageShapeName, imageShapes } from "@/front/lib/constants";
export type TripleColType = {
image: ImageProps;
title: TextProps;
subtitle?: TextProps;
description: TextProps;
};
type Props = {
cols: TripleColType[];
variant?: BgColorName;
shape?: ImageShapeName;
};
export default function TripleCol(props: Props) {
const { cols, variant, shape = imageShapes.ROUNDED } = props;
const width = "w-72 lg:w-56";
const height = "aspect-square lg:h-56";
const separatorVariant =
variant === bgColors.BACKGROUND ? bgColors.PRIMARY : bgColors.BACKGROUND;
return (
<div className="grid md:grid-cols-3 grid-cols-1 md:gap-8">
{cols.map((col, index) => {
const isLast = index === cols.length - 1;
return (
<div className="text-center flex flex-col items-center gap-3 md:gap-5">
<Image
size={`${width} ${height}`}
image={col.image}
shape={shape}
/>
<div>
<h4
className={cn(
"text-2xl uppercase",
col.title.font,
col.title.weight ?? "font-bold ",
)}
>
{col.title.text}
</h4>
{col.subtitle && (
<h5
className={cn(
"text-2xl",
col.subtitle.font ?? fonts.DELIUS_SWASH,
col.subtitle.weight ?? "font-normal",
)}
>
{col.subtitle.text}
</h5>
)}
</div>
<p
// eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{
__html: col.description.text,
}}
className={cn(col.title.font, col.title.weight ?? "font-normal ")}
/>
{!isLast && (
<Separator
className={cn("md:hidden w-[70%] h-3 my-12", separatorVariant)}
/>
)}
</div>
);
})}
</div>
);
}