mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-17 13:55:50 +00:00
34 lines
861 B
TypeScript
34 lines
861 B
TypeScript
'use client';
|
|
|
|
import { cn } from '../../src/lib/utils';
|
|
import { motion } from 'motion/react';
|
|
import { type ElementType, type JSX, memo } from 'react';
|
|
|
|
export interface TextShimmerProps {
|
|
children: string;
|
|
as?: ElementType;
|
|
className?: string;
|
|
duration?: number;
|
|
spread?: number;
|
|
}
|
|
|
|
const ShimmerComponent = ({ children, as: Component = 'p', className, duration = 2 }: TextShimmerProps) => {
|
|
const MotionComponent = motion.create(Component as keyof JSX.IntrinsicElements);
|
|
|
|
return (
|
|
<MotionComponent
|
|
animate={{ opacity: [0.5, 1, 0.5] }}
|
|
className={cn('relative inline-block text-muted-foreground', className)}
|
|
transition={{
|
|
repeat: Number.POSITIVE_INFINITY,
|
|
duration,
|
|
ease: 'easeInOut',
|
|
}}
|
|
>
|
|
{children}
|
|
</MotionComponent>
|
|
);
|
|
};
|
|
|
|
export const Shimmer = memo(ShimmerComponent);
|