Stats Minimal
Stats Minimal é um componente de dados para React e Tailwind CSS, da biblioteca UI Layouts, com licença MIT. Copia e cola no teu projeto.
UI Layouts
MIT
data
O que é
Stats Minimal é um componente de dados para React e Tailwind CSS, da biblioteca UI Layouts, com licença MIT. Copia e cola no teu projeto.
Como usar
Abre o componente no catálogo, carrega em copiar, e cola no teu projeto. O prompt copiado leva o código e as regras para o teu agente o reproduzir sem alterar nada.
Cinco cópias grátis por mês. Sem cartão.
Precisa de
npm i motion
Licença
Este componente vem de UI Layouts e é redistribuído sob a licença MIT, que permite uso comercial. O aviso de copyright viaja com o código.
Stats Minimal
import React from 'react'
const stats = [
{ label: 'Active Users', value: '1.2M+' },
{ label: 'Uptime', value: '99.9%' },
{ label: 'Response Time', value: '42ms' },
{ label: 'Global Edge', value: '250+' },
]
export const MinimalStats = () => {
return (
<section className="bg-white min-h-screen flex flex-col justify-center font-manrope">
<div className="max-w-7xl mx-auto px-5">
<div className="flex justify-between">
{stats.map((stat) => (
<div
key={stat.label}
className="flex flex-col gap-1 border-l border-zinc-200 px-6 py-2 hover:bg-zinc-200"
>
<p className="text-3xl font-bold tracking-tight text-zinc-900 ">
{stat.value}
</p>
<p className="text-xs font-medium text-zinc-500 uppercase tracking-widest">
{stat.label}
</p>
</div>
))}
</div>
</div>
</section>
)
}
import type { Variants } from 'motion/react';
import { type HTMLMotionProps, motion, useInView } from 'motion/react';
import type React from 'react';
type TimelineContentProps<T extends keyof HTMLElementTagNameMap> = {
children?: React.ReactNode;
animationNum: number;
className?: string;
timelineRef: React.RefObject<HTMLElement | null>;
as?: T;
customVariants?: Variants;
once?: boolean;
} & HTMLMotionProps<T>;
export const TimelineAnimation = <T extends keyof HTMLElementTagNameMap = 'div'>({
children,
animationNum,
timelineRef,
className,
as,
customVariants,
once = true,
...props
}: TimelineContentProps<T>) => {
const defaultSequenceVariants = {
visible: (i: number) => ({
filter: 'blur(0px)',
y: 0,
opacity: 1,
transition: {
delay: i * 0.5,
duration: 0.5,
},
}),
hidden: {
filter: 'blur(20px)',
y: 0,
opacity: 0,
},
};
const sequenceVariants = customVariants || defaultSequenceVariants;
const isInView = useInView(timelineRef, {
once,
});
const MotionComponent = motion[as || 'div'] as React.ElementType;
return (
<MotionComponent
initial='hidden'
animate={isInView ? 'visible' : 'hidden'}
custom={animationNum}
variants={sequenceVariants}
className={className}
{...props}
>
{children}
</MotionComponent>
);
};