mirror of
https://github.com/lucide-icons/lucide.git
synced 2025-12-17 09:07:43 +01:00
* Add types plugin * Add js doc comment * Only enable dynamic imports for CJS and ESM builds * Add documentation * Adjust docs * Add test for dynamic import * Adjust note * Adjustment in docs
34 lines
978 B
JavaScript
34 lines
978 B
JavaScript
export default ({ componentName, iconName, children, getSvg }) => {
|
|
const svgContents = getSvg();
|
|
|
|
const svgBase64 = Buffer.from(
|
|
svgContents
|
|
.replace('\n', '')
|
|
.replace(
|
|
'stroke="currentColor"',
|
|
'stroke="#000" style="background-color: #fff; border-radius: 2px"',
|
|
),
|
|
).toString('base64');
|
|
|
|
// declarationFileContent += `\
|
|
|
|
return `
|
|
import createLucideIcon from '../createLucideIcon';
|
|
|
|
/**
|
|
* @component @name ${componentName}
|
|
* @description Lucide SVG icon component, renders SVG Element with children.
|
|
*
|
|
* @preview  - https://lucide.dev/icons/${iconName}
|
|
* @see https://lucide.dev/guide/packages/lucide-react - Documentation
|
|
*
|
|
* @param {Object} props - Lucide icons props and any valid SVG attribute
|
|
* @returns {JSX.Element} JSX Element
|
|
*
|
|
*/
|
|
const ${componentName} = createLucideIcon('${componentName}', ${JSON.stringify(children)});
|
|
|
|
export default ${componentName};
|
|
`;
|
|
};
|