Files
MathApp_frontend/src/components/NodeIcon.tsx

19 lines
826 B
TypeScript

import {
BarChart3, BookOpen, Brain, Compass, Grid3x3, LineChart, Network, Play, Repeat, Sigma, Sparkles, TrendingUp,
type LucideIcon,
} from 'lucide-react';
/**
* آیکنِ جزیره. سرور نامِ آیکنِ lucide را می‌دهد (مثلاً "Grid3x3")؛ فقط این
* مجموعه‌ی کوچک در باندل است تا کلِ کتابخانه‌ی آیکن بار نشود.
*/
const ICONS: Record<string, LucideIcon> = {
Grid3x3, TrendingUp, LineChart, Sigma, Compass, Repeat, BookOpen, Sparkles, Brain, Play, BarChart3, Network,
};
const FALLBACK: LucideIcon[] = [Grid3x3, TrendingUp, LineChart, Sigma, Compass, Repeat, BookOpen, Sparkles, Brain];
export function iconFor(name: string | undefined, index = 0): LucideIcon {
return (name && ICONS[name]) || FALLBACK[index % FALLBACK.length];
}