Files
dashboard-icons/web/src/components/magicui/aurora-text.tsx

38 lines
932 B
TypeScript
Raw Normal View History

2025-04-17 15:12:28 +02:00
"use client"
2025-04-17 15:11:17 +02:00
2025-04-17 15:12:28 +02:00
import type React from "react"
import { memo } from "react"
2025-04-17 15:11:17 +02:00
interface AuroraTextProps {
2025-04-17 15:12:28 +02:00
children: React.ReactNode
className?: string
colors?: string[]
speed?: number
2025-04-17 15:11:17 +02:00
}
export const AuroraText = memo(
2025-04-17 15:12:28 +02:00
({ children, className = "", colors = ["#FF0080", "#7928CA", "#0070F3", "#38bdf8"], speed = 1 }: AuroraTextProps) => {
const gradientStyle = {
backgroundImage: `linear-gradient(135deg, ${colors.join(", ")}, ${colors[0]})`,
WebkitBackgroundClip: "text",
WebkitTextFillColor: "transparent",
animationDuration: `${10 / speed}s`,
}
2025-04-17 15:11:17 +02:00
2025-04-17 15:12:28 +02:00
return (
<span className={`relative inline-block ${className}`}>
<span className="sr-only">{children}</span>
<span
className="relative animate-aurora bg-[length:200%_auto] bg-clip-text text-transparent"
style={gradientStyle}
aria-hidden="true"
>
{children}
</span>
</span>
)
},
)
2025-04-17 15:11:17 +02:00
2025-04-17 15:12:28 +02:00
AuroraText.displayName = "AuroraText"