Update lazy.ts
This commit is contained in:
@@ -9,7 +9,7 @@
|
|||||||
* const PlusIcon = lazyIcon('plus');
|
* const PlusIcon = lazyIcon('plus');
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { lazy, ComponentType } from 'react';
|
import React, { lazy, ComponentType } from 'react';
|
||||||
|
|
||||||
// Icon name to component mapping
|
// Icon name to component mapping
|
||||||
const iconMap: Record<string, () => Promise<{ default: ComponentType<any> }>> = {
|
const iconMap: Record<string, () => Promise<{ default: ComponentType<any> }>> = {
|
||||||
@@ -81,7 +81,7 @@ export function lazyIcon(iconName: string): ComponentType<any> {
|
|||||||
if (!loader) {
|
if (!loader) {
|
||||||
console.warn(`Icon "${iconName}" not found. Available icons: ${Object.keys(iconMap).join(', ')}`);
|
console.warn(`Icon "${iconName}" not found. Available icons: ${Object.keys(iconMap).join(', ')}`);
|
||||||
// Return a placeholder component
|
// Return a placeholder component
|
||||||
return () => <span>?</span>;
|
return () => React.createElement('span', null, '?');
|
||||||
}
|
}
|
||||||
return lazy(loader);
|
return lazy(loader);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user