Files
bedolaga-cabinet/src/components/ui/backgrounds/meteors.tsx
Fringg 1a702a68b9 feat: replace animated backgrounds with Aceternity UI system
- Add 16 animated background components (aurora, sparkles, vortex, shooting-stars,
  beams, beams-collision, gradient-animation, wavy, lines, boxes, meteors, grid,
  dots, spotlight, noise, ripple, gemini-effect)
- Add full admin BackgroundEditor with live preview, type gallery, per-type settings
- Add BackgroundRenderer with lazy loading, localStorage cache, mobile reduction
- Add input sanitization (sanitizeColor, clampNumber) across all components
- Add translations for en, ru, zh, fa locales
- Remove old Aurora (WebGL/OGL) and AnimatedBackground (CSS wave-blob)
- Remove ogl dependency, add simplex-noise
2026-02-25 07:12:59 +03:00

51 lines
1.5 KiB
TypeScript

import { useMemo } from 'react';
import { sanitizeColor, clampNumber } from './types';
interface Props {
settings: Record<string, unknown>;
}
export default function Meteors({ settings }: Props) {
const count = clampNumber(settings.count, 1, 50, 20);
const meteorColor = sanitizeColor(settings.meteorColor, '#ffffff');
const meteors = useMemo(
() =>
Array.from({ length: count }, (_, i) => ({
id: i,
left: `${Math.random() * 100}%`,
delay: `${Math.random() * 5}s`,
duration: `${2 + Math.random() * 6}s`,
size: `${1 + Math.random()}px`,
})),
[count],
);
return (
<div className="absolute inset-0 overflow-hidden">
{meteors.map((meteor) => (
<span
key={meteor.id}
className="absolute top-0 rotate-[215deg] animate-meteor-effect rounded-[9999px]"
style={{
left: meteor.left,
animationDelay: meteor.delay,
animationDuration: meteor.duration,
width: meteor.size,
height: meteor.size,
boxShadow: `0 0 0 1px rgba(255,255,255,0.05), 0 0 2px 1px ${meteorColor}20, 0 0 20px 2px ${meteorColor}40`,
background: meteorColor,
}}
>
<div
className="pointer-events-none absolute top-1/2 -z-10 h-px w-[50px] -translate-y-1/2"
style={{
background: `linear-gradient(to right, ${meteorColor}, transparent)`,
}}
/>
</span>
))}
</div>
);
}