mirror of
https://github.com/iconoir-icons/iconoir
synced 2024-06-04 15:02:34 +02:00
23 lines
411 B
JavaScript
23 lines
411 B
JavaScript
const template = (
|
|
{ template },
|
|
opts,
|
|
{ imports, interfaces, componentName, props, jsx, exports }
|
|
) => {
|
|
const plugins = ['jsx'];
|
|
if (opts.typescript) {
|
|
plugins.push('typescript');
|
|
}
|
|
const typeScriptTpl = template.smart({ plugins });
|
|
return typeScriptTpl.ast`${imports}
|
|
|
|
${interfaces}
|
|
|
|
function ${componentName}(${props}) {
|
|
return ${jsx};
|
|
}
|
|
${exports}
|
|
`;
|
|
};
|
|
|
|
module.exports = template;
|