refactor: switch shine text to CSS shimmer

This commit is contained in:
Bohdan Triapitsyn
2026-04-03 19:38:37 +03:00
parent 246464a325
commit 2c56cb021f
2 changed files with 107 additions and 16 deletions
+12 -16
View File
@@ -21,23 +21,19 @@ const variants = [
{
variant: "shine",
component: ({ children, className, ...props }) => (
<motion.span
{...props}
className={cn(
"bg-[linear-gradient(110deg,color-mix(in_srgb,var(--surface-muted-foreground)_45%,transparent),35%,var(--surface-foreground),50%,color-mix(in_srgb,var(--surface-muted-foreground)_45%,transparent),75%,color-mix(in_srgb,var(--surface-muted-foreground)_45%,transparent))]",
"bg-[length:200%_100%] bg-clip-text text-transparent",
className
)}
initial={{ backgroundPosition: "200% 0" }}
animate={{ backgroundPosition: "-200% 0" }}
transition={{
repeat: Number.POSITIVE_INFINITY,
duration: 2,
ease: "linear",
}}
<span
{...props}
data-component="oc-text-shimmer"
data-active="true"
className={className}
>
{children}
</motion.span>
<span data-slot="text-shimmer-char">
<span data-slot="text-shimmer-char-base">{children}</span>
<span data-slot="text-shimmer-char-shimmer" data-run="true" aria-hidden="true">
{children}
</span>
</span>
</span>
),
},
{