Files
3df875bd-3de5-46d4-bbca-c04…/src/components/sections/metrics/MetricsSimpleCards.tsx
2026-05-05 11:59:18 +03:00

110 lines
3.5 KiB
TypeScript

import { motion } from "motion/react";
type Metric = {
value: string;
description: string;
};
type MetricsSimpleCardsProps = {
tag: string;
title: string;
description: string;
primaryButton?: { text: string; href: string };
secondaryButton?: { text: string; href: string };
metrics: Metric[];
};
const MetricsSimpleCards = ({
tag,
title,
description,
primaryButton,
secondaryButton,
metrics,
}: MetricsSimpleCardsProps) => {
return (
<section
data-webild-section="MetricsSimpleCards"
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 justify-between gap-5 p-5 min-h-70 h-full card rounded-theme"
>
<span className="text-7xl md:text-8xl font-medium leading-none truncate">
{metric.value}
</span>
<p className="text-base leading-tight text-balance">{metric.description}</p>
</div>
))}
</motion.div>
</div>
</section>
);
};
export default MetricsSimpleCards;