2023-07-13 16:39:02 +02:00
|
|
|
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 `
|
2023-01-17 08:04:34 +01:00
|
|
|
import createLucideIcon from '../createLucideIcon';
|
2022-06-12 22:31:05 +02:00
|
|
|
|
2023-07-13 16:39:02 +02:00
|
|
|
/**
|
|
|
|
|
* @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
|
|
|
|
|
*
|
|
|
|
|
*/
|
2023-01-17 08:04:34 +01:00
|
|
|
const ${componentName} = createLucideIcon('${componentName}', ${JSON.stringify(children)});
|
2022-06-12 22:31:05 +02:00
|
|
|
|
|
|
|
|
export default ${componentName};
|
|
|
|
|
`;
|
2023-07-13 16:39:02 +02:00
|
|
|
};
|