dashboard-icons/web/src/components/magicui/animated-shiny-text.tsx

34 lines
930 B
TypeScript
Raw Normal View History

2025-04-17 15:12:28 +02:00
import type { CSSProperties, ComponentPropsWithoutRef, FC } from "react"
2025-04-17 15:11:17 +02:00
2025-04-17 15:12:28 +02:00
import { cn } from "@/lib/utils"
2025-04-17 15:11:17 +02:00
2025-04-17 15:12:28 +02:00
export interface AnimatedShinyTextProps extends ComponentPropsWithoutRef<"span"> {
shimmerWidth?: number
2025-04-17 15:11:17 +02:00
}
2025-04-17 15:12:28 +02:00
export const AnimatedShinyText: FC<AnimatedShinyTextProps> = ({ children, className, shimmerWidth = 100, ...props }) => {
return (
<span
style={
{
"--shiny-width": `${shimmerWidth}px`,
} as CSSProperties
}
className={cn(
"mx-auto max-w-md text-neutral-600/70 dark:text-neutral-400/70",
2025-04-17 15:11:17 +02:00
2025-04-17 15:12:28 +02:00
// Shine effect
"animate-shiny-text bg-clip-text bg-no-repeat [background-position:0_0] [background-size:var(--shiny-width)_100%] [transition:background-position_1s_cubic-bezier(.6,.6,0,1)_infinite]",
2025-04-17 15:11:17 +02:00
2025-04-17 15:12:28 +02:00
// Shine gradient
"bg-gradient-to-r from-transparent via-black/80 via-50% to-transparent dark:via-white/80",
2025-04-17 15:11:17 +02:00
2025-04-17 15:12:28 +02:00
className,
)}
{...props}
>
{children}
</span>
)
}