"use client"; import { cn } from "@lib/utils"; import { motion } from "motion/react"; import React, { type JSX, useMemo } from "react"; export type TextShimmerProps = { children: string; as?: React.ElementType; className?: string; duration?: number; spread?: number; }; function TextShimmerComponent({ children, as: Component = "p", className, duration = 2, spread = 2, }: TextShimmerProps) { 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);