mirror of
https://github.com/lucide-icons/lucide.git
synced 2025-12-19 02:59:22 +01:00
feat(lucide-react): Add DynamicIcon component (#2686)
* Adding the DynamicIcon component * Fix imports * Add docs * Formatting * Fix use client in output rollup * revert changes * Fix formatting * Revert changes in icons directory * Revert time command * update exports
This commit is contained in:
@@ -7,6 +7,9 @@ export default ({ componentName, iconName, children, getSvg, deprecated, depreca
|
||||
|
||||
return `
|
||||
import createLucideIcon from '../createLucideIcon';
|
||||
import { IconNode } from '../types';
|
||||
|
||||
export const __iconNode: IconNode = ${JSON.stringify(children)}
|
||||
|
||||
/**
|
||||
* @component @name ${componentName}
|
||||
@@ -19,7 +22,7 @@ import createLucideIcon from '../createLucideIcon';
|
||||
* @returns {JSX.Element} JSX Element
|
||||
* ${deprecated ? `@deprecated ${deprecationReason}` : ''}
|
||||
*/
|
||||
const ${componentName} = createLucideIcon('${componentName}', ${JSON.stringify(children)});
|
||||
const ${componentName} = createLucideIcon('${componentName}', __iconNode);
|
||||
|
||||
export default ${componentName};
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user