erp-platform/ui/src/configs/navigation-icon.config.tsx

25 lines
603 B
TypeScript
Raw Normal View History

2025-05-06 06:45:49 +00:00
import * as fc from 'react-icons/fc'
import * as fa from 'react-icons/fa'
2025-10-12 18:45:03 +00:00
import type { ComponentType } from 'react'
2025-05-06 06:45:49 +00:00
2025-10-12 18:45:03 +00:00
export type NavigationIcons = Record<string, ComponentType<any>>
2025-05-06 06:45:49 +00:00
2025-10-12 18:45:03 +00:00
const navigationIcon: NavigationIcons = {}
2025-05-06 06:45:49 +00:00
2025-10-12 18:45:03 +00:00
function registerIcons(iconModule: Record<string, any>) {
for (const [key, Icon] of Object.entries(iconModule)) {
if (
Icon &&
(typeof Icon === 'function' ||
(typeof Icon === 'object' && 'render' in Icon))
) {
navigationIcon[key] = Icon as ComponentType<any>
}
}
2025-05-06 06:45:49 +00:00
}
2025-10-12 18:45:03 +00:00
registerIcons(fc)
registerIcons(fa)
2025-10-12 18:45:03 +00:00
export default navigationIcon