"use client"; import { cn } from "src/lib/utils"; import { motion } from "motion/react"; import type { CSSProperties, ElementType } from "react"; import { memo, useMemo } from "react"; export interface TextShimmerProps { children: string; as?: ElementType; className?: string; duration?: number; spread?: number; } const ShimmerComponent = ({ children, as: Component = "p", className, duration = 2, spread = 2, }: TextShimmerProps) => { const dynamicSpread = useMemo( () => (children?.length ?? 0) * spread, [children, spread] ); // Use the motion proxy directly for string tags. // This avoids calling motion.create() which the linter sees as "creating a component in render". const MotionTag = typeof Component === 'string' ? (motion as unknown as Record)[Component] || motion.p : motion.p; return ( {children} ); }; export const Shimmer = memo(ShimmerComponent);