Testimonial 36
card4 ColumnsText Align CenterBackground ImageCardsIconsButtons

Code
relume-testimonial36.tsx
import clsx from "clsx";
import { BackgroundCard, Card } from "@/components/ui/card";
import { Button, type ButtonProps } from "@/components/ui/button";
import { ChevronRight, StarFull } from "relume-icons";
type ImageProps = {
src: string;
alt?: string;
};
type BackgroundImageCardProps = {
backgroundImage: ImageProps;
heading: string;
button: ButtonProps;
};
type LogoCardProps = {
logo: ImageProps;
};
type QuoteCardProps = {
numberOfStars: number;
quote: string;
image: ImageProps;
name: string;
position: string;
companyName: string;
};
type Props = {
heading: string;
description: string;
testimonialCards: (
| { component: "background"; props: BackgroundImageCardProps }
| { component: "logo"; props: LogoCardProps }
| { component: "quote"; props: QuoteCardProps }
)[];
};
export type Testimonial36Props = React.ComponentPropsWithoutRef<"section"> & Partial<Props>;
export const Testimonial36 = (props: Testimonial36Props) => {
const { heading, description, testimonialCards } = {
...Testimonial36Defaults,
...props,
};
let logoCardCount = 0;
let backgroundImageCardCount = 0;
return (
<section className="px-[5%] py-16 md:py-24 lg:py-28">
<div className="container">
<div className="mb-12 md:mb-18 lg:mb-20">
<div className="mx-auto max-w-lg text-center">
<h1 className="mb-5 text-h2 font-bold md:mb-6">{heading}</h1>
<p className="text-medium">{description}</p>
</div>
</div>
<div className="gid-cols-1 grid gap-6 sm:grid-rows-6 md:grid-cols-2 md:gap-8 lg:grid-cols-4 lg:grid-rows-2">
{testimonialCards.map((card, index) => {
if (card.component === "background") {
backgroundImageCardCount++;
return (
<BackgroundImageCard
key={index}
isFourth={backgroundImageCardCount === 4}
{...card.props}
/>
);
} else if (card.component === "logo") {
logoCardCount++;
return <LogoCard key={index} isThird={logoCardCount === 3} {...card.props} />;
} else {
return <QuoteCard key={index} {...card.props} />;
}
})}
</div>
</div>
</section>
);
};
const BackgroundImageCard = ({
backgroundImage,
heading,
button,
isFourth,
}: BackgroundImageCardProps & { isFourth?: boolean }) => (
<BackgroundCard
className={clsx("relative p-6 md:p-8 lg:p-6", { "order-last lg:order-none": isFourth })}
>
<div className="relative z-10 flex h-full flex-col items-start justify-between">
<h3 className="text-h4 font-bold text-white">{heading}</h3>
<div className="mt-6 md:mt-8">
<Button {...button}>{button.title}</Button>
</div>
</div>
<div className="absolute inset-0 z-0">
<img src={backgroundImage.src} className="size-full object-cover" alt={backgroundImage.alt} />
<div className="absolute inset-0 bg-neutral-darkest/50" />
</div>
</BackgroundCard>
);
const LogoCard = ({ logo, isThird }: LogoCardProps & { isThird?: boolean }) => (
<Card
className={clsx("flex items-center justify-center p-6 md:p-8 lg:p-6", {
"sm:col-start-2 sm:col-end-3 sm:row-start-4 sm:row-end-5 lg:col-auto lg:row-auto": isThird,
})}
>
<img src={logo.src} alt={logo.alt} className="max-h-12" />
</Card>
);
const QuoteCard = ({
numberOfStars,
quote,
image,
name,
position,
companyName,
}: QuoteCardProps) => (
<Card className="flex flex-col items-start justify-between p-6 sm:col-span-2 md:p-8">
<div className="mb-5 flex gap-1 md:mb-6">
{Array(numberOfStars)
.fill(null)
.map((_, index) => (
<StarFull key={index} className="size-6 text-scheme-text" />
))}
</div>
<h5 className="text-medium">{quote}</h5>
<div className="mt-5 flex w-full flex-col items-start md:mt-6 md:w-fit md:flex-row md:items-center">
<div>
<img src={image.src} alt={image.alt} className="size-full object-cover" />
</div>
<div>
<p className="font-semibold">{name}</p>
<p>
<span>{position}</span>, <span>{companyName}</span>
</p>
</div>
</div>
</Card>
);
export const Testimonial36Defaults: Props = {
heading: "Customer testimonials",
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
testimonialCards: [
{
component: "background",
props: {
backgroundImage: {
src: "https://d22po4pjz3o32e.cloudfront.net/placeholder-image.svg",
alt: "Relume placeholder image 1",
},
heading: "Short heading goes here",
button: {
title: "Button",
variant: "link-alt",
size: "link",
iconRight: <ChevronRight className="text-white" />,
},
},
},
{
component: "logo",
props: {
logo: {
src: "https://d22po4pjz3o32e.cloudfront.net/relume-logo.svg",
alt: "Relume logo 1",
},
},
},
{
component: "quote",
props: {
numberOfStars: 5,
quote:
'"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare."',
image: {
src: "https://d22po4pjz3o32e.cloudfront.net/placeholder-image.svg",
alt: "Testimonial image 1",
},
name: "Name Surname",
position: "Position",
companyName: "Company name",
},
},
{
component: "logo",
props: {
logo: {
src: "https://d22po4pjz3o32e.cloudfront.net/webflow-logo.svg",
alt: "Webflow logo 1",
},
},
},
{
component: "background",
props: {
backgroundImage: {
src: "https://d22po4pjz3o32e.cloudfront.net/placeholder-image.svg",
alt: "Relume placeholder image 2",
},
heading: "Short heading goes here",
button: {
title: "Button",
variant: "link-alt",
size: "link",
iconRight: <ChevronRight className="text-white" />,
},
},
},
{
component: "logo",
props: {
logo: {
src: "https://d22po4pjz3o32e.cloudfront.net/relume-logo.svg",
alt: "Relume logo 2",
},
},
},
{
component: "background",
props: {
backgroundImage: {
src: "https://d22po4pjz3o32e.cloudfront.net/placeholder-image.svg",
alt: "Relume placeholder image 3",
},
heading: "Short heading goes here",
button: {
title: "Button",
variant: "link-alt",
size: "link",
iconRight: <ChevronRight className="text-white" />,
},
},
},
{
component: "quote",
props: {
numberOfStars: 5,
quote:
'"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare."',
image: {
src: "https://d22po4pjz3o32e.cloudfront.net/placeholder-image.svg",
alt: "Testimonial image 2",
},
name: "Name Surname",
position: "Position",
companyName: "Company name",
},
},
{
component: "background",
props: {
backgroundImage: {
src: "https://d22po4pjz3o32e.cloudfront.net/placeholder-image.svg",
alt: "Relume placeholder image 4",
},
heading: "Short heading goes here",
button: {
title: "Button",
variant: "link-alt",
size: "link",
iconRight: <ChevronRight className="text-white" />,
},
},
},
{
component: "logo",
props: {
logo: {
src: "https://d22po4pjz3o32e.cloudfront.net/webflow-logo.svg",
alt: "Webflow logo 2",
},
},
},
],
};npm i @radix-ui/react-dialog @radix-ui/react-slot @radix-ui/react-tabs class-variance-authority@0.7.1 clsx@^2.1.1 embla-carousel-react@^8.5.2 relume-icons@1.3.0 tailwind-merge@^2.2.2


