"use client"; import { memo } from "react"; import { cls, shouldUseInvertedText } from "@/lib/utils"; import { useTheme } from "@/providers/themeProvider/ThemeProvider"; import type { LucideIcon } from "lucide-react"; import type { InvertedBackground } from "@/providers/themeProvider/config/constants"; export type OrbitingItem = { icon: LucideIcon; ring?: 1 | 2 | 3; // Which ring to orbit on (1=innermost, 3=outermost), defaults to 2 duration?: number; // Animation duration in seconds, defaults to 10 }; interface BentoOrbitingIconsProps { centerIcon: LucideIcon; items: OrbitingItem[]; useInvertedBackground: InvertedBackground; className?: string; } const BentoOrbitingIcons = ({ centerIcon, items, useInvertedBackground, className = "", }: BentoOrbitingIconsProps) => { const theme = useTheme(); const shouldUseLightText = shouldUseInvertedText(useInvertedBackground, theme.cardStyle); const CenterIcon = centerIcon; const circleStyles = "secondary-button border border-background-accent! shadow rounded-full"; return (
{/* Background concentric circles */}
{/* Center circle with icon */}
{/* Orbiting items */} {items.map((item, index) => { const Icon = item.icon; const ring = item.ring || 2; // Ring radii: 7.5rem=120px, 10rem=160px, 12.5rem=200px const radiusMap = { 1: 120, 2: 160, 3: 200 }; const radius = radiusMap[ring]; const duration = item.duration || 10; // Evenly distribute items around the circle const initialPosition = (360 / items.length) * index; return (
); })}
); }; BentoOrbitingIcons.displayName = "BentoOrbitingIcons"; export default memo(BentoOrbitingIcons);