115 lines
3.8 KiB
TypeScript
115 lines
3.8 KiB
TypeScript
import { motion } from "motion/react";
|
|
import { Sparkles, type LucideIcon } from "lucide-react";
|
|
|
|
type Metric = {
|
|
icon: string | LucideIcon;
|
|
title: string;
|
|
value: string;
|
|
};
|
|
|
|
type MetricsIconCardsProps = {
|
|
tag: string;
|
|
title: string;
|
|
description: string;
|
|
primaryButton?: { text: string; href: string };
|
|
secondaryButton?: { text: string; href: string };
|
|
metrics: Metric[];
|
|
};
|
|
|
|
const MetricsIconCards = ({
|
|
tag,
|
|
title,
|
|
description,
|
|
primaryButton,
|
|
secondaryButton,
|
|
metrics,
|
|
}: MetricsIconCardsProps) => {
|
|
return (
|
|
<section
|
|
data-webild-section="MetricsIconCards"
|
|
aria-label="Metrics section"
|
|
className="relative w-full py-20"
|
|
>
|
|
<div className="flex flex-col gap-8">
|
|
<div className="flex flex-col items-center gap-2 w-content-width mx-auto">
|
|
<motion.span
|
|
initial={{ opacity: 0, y: 20 }}
|
|
whileInView={{ opacity: 1, y: 0 }}
|
|
viewport={{ once: true, margin: "-15%" }}
|
|
transition={{ duration: 0.6, ease: "easeOut" }}
|
|
className="card rounded-full px-3 py-1 mb-1 text-sm"
|
|
>
|
|
{tag}
|
|
</motion.span>
|
|
|
|
<motion.h2
|
|
initial={{ opacity: 0, y: 20 }}
|
|
whileInView={{ opacity: 1, y: 0 }}
|
|
viewport={{ once: true, margin: "-15%" }}
|
|
transition={{ duration: 0.6, delay: 0.05, ease: "easeOut" }}
|
|
className="text-6xl font-medium text-center text-balance"
|
|
>
|
|
{title}
|
|
</motion.h2>
|
|
|
|
<motion.p
|
|
initial={{ opacity: 0, y: 20 }}
|
|
whileInView={{ opacity: 1, y: 0 }}
|
|
viewport={{ once: true, margin: "-15%" }}
|
|
transition={{ duration: 0.6, delay: 0.15, ease: "easeOut" }}
|
|
className="md:max-w-6/10 text-lg leading-tight text-center"
|
|
>
|
|
{description}
|
|
</motion.p>
|
|
|
|
{(primaryButton || secondaryButton) && (
|
|
<div className="flex flex-wrap justify-center gap-3 mt-3">
|
|
{primaryButton && (
|
|
<a
|
|
href={primaryButton.href}
|
|
className="primary-button rounded-theme h-9 px-6 inline-flex items-center justify-center text-sm text-primary-cta-text"
|
|
>
|
|
{primaryButton.text}
|
|
</a>
|
|
)}
|
|
{secondaryButton && (
|
|
<a
|
|
href={secondaryButton.href}
|
|
className="secondary-button rounded-theme h-9 px-6 inline-flex items-center justify-center text-sm text-secondary-cta-text"
|
|
>
|
|
{secondaryButton.text}
|
|
</a>
|
|
)}
|
|
</div>
|
|
)}
|
|
</div>
|
|
|
|
<motion.div
|
|
initial={{ opacity: 0, y: 20 }}
|
|
whileInView={{ opacity: 1, y: 0 }}
|
|
viewport={{ once: true, margin: "-10%" }}
|
|
transition={{ duration: 0.6, delay: 0.2, ease: "easeOut" }}
|
|
className="grid grid-cols-1 md:grid-cols-3 gap-5 w-content-width mx-auto"
|
|
>
|
|
{metrics.map((metric) => (
|
|
<div
|
|
key={metric.value}
|
|
className="flex flex-col items-center justify-center gap-3 p-5 min-h-70 h-full card rounded-theme"
|
|
>
|
|
<div className="flex items-center justify-center gap-2">
|
|
<div className="flex items-center justify-center size-8 primary-button rounded-full">
|
|
<Sparkles className="w-4 h-4 text-primary-cta-text" />
|
|
</div>
|
|
<span className="text-xl truncate">{metric.title}</span>
|
|
</div>
|
|
<span className="text-7xl font-medium leading-none truncate">{metric.value}</span>
|
|
</div>
|
|
))}
|
|
</motion.div>
|
|
</div>
|
|
</section>
|
|
);
|
|
};
|
|
|
|
export default MetricsIconCards;
|