* 根据图标名称获取 Lucide 图标组件
(iconName: string | undefined, size: number = 16)
| 18 | * 根据图标名称获取 Lucide 图标组件 |
| 19 | */ |
| 20 | function getIconComponent(iconName: string | undefined, size: number = 16): React.ReactNode { |
| 21 | if (!iconName) return <Plus size={size} />; |
| 22 | const icons = LucideIcons as unknown as Record<string, React.ComponentType<{ size?: number }>>; |
| 23 | const IconComponent = icons[iconName]; |
| 24 | if (IconComponent) { |
| 25 | return <IconComponent size={size} />; |
| 26 | } |
| 27 | return <Plus size={size} />; |
| 28 | } |
| 29 | |
| 30 | interface TreeNode { |
| 31 | name: string; |
no outgoing calls
no test coverage detected