24 lines
603 B
TypeScript
24 lines
603 B
TypeScript
import * as fc from 'react-icons/fc'
|
|
import * as fa from 'react-icons/fa'
|
|
import type { ComponentType } from 'react'
|
|
|
|
export type NavigationIcons = Record<string, ComponentType<any>>
|
|
|
|
const navigationIcon: NavigationIcons = {}
|
|
|
|
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>
|
|
}
|
|
}
|
|
}
|
|
|
|
registerIcons(fc)
|
|
registerIcons(fa)
|
|
|
|
export default navigationIcon
|