import React, { useMemo, type JSX } from 'react'; import { motion, useReducedMotion } from 'motion/react'; export interface TextShimmerProps { children: string; as?: React.ElementType; className?: string; duration?: number; spread?: number; } function TextShimmerComponent({ children, as: Component = 'span', className, duration = 2, spread = 2, }: TextShimmerProps) { const shouldReduceMotion = useReducedMotion(); const MotionComponent = motion.create( Component as keyof JSX.IntrinsicElements ); const dynamicSpread = useMemo(() => { return children.length * spread; }, [children, spread]); return ( {children} ); } export const TextShimmer = React.memo(TextShimmerComponent);