'use client'; import { type CSSProperties, type ElementType, type JSX, memo, useMemo } from 'react'; import { motion } from 'motion/react'; import { cn } from '@/lib/shadcn/utils'; export type TextShimmerProps = { children: string; as?: ElementType; className?: string; duration?: number; spread?: number; }; const ShimmerComponent = ({ children, as: Component = 'p', className, duration = 2, spread = 2, }: TextShimmerProps) => { const MotionComponent = motion.create(Component as keyof JSX.IntrinsicElements); const dynamicSpread = useMemo(() => (children?.length ?? 0) * spread, [children, spread]); return ( {children} ); }; export const Shimmer = memo(ShimmerComponent);