Skip to content

Commit 29b2723

Browse files
committed
chore: add .svgrrc.js
1 parent a330ac1 commit 29b2723

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
module.exports = {
2+
icon: true,
3+
typescript: true,
4+
svgProps: {
5+
viewBox: '0 0 1024 1024',
6+
fill: 'currentColor',
7+
},
8+
outDir: './src/icons',
9+
template: function (
10+
{ template },
11+
opts,
12+
{ imports, interfaces, componentName, props, jsx, exports },
13+
) {
14+
const plugins = ['jsx'];
15+
if (opts.typescript) {
16+
plugins.push('typescript');
17+
}
18+
const typeScriptTpl = template.smart({ plugins });
19+
return typeScriptTpl.ast`${imports}
20+
${interfaces}
21+
import IconBase, { IconBaseProps } from './IconBase';
22+
const SvgIcon = (${props}: React.SVGProps<SVGSVGElement>) => ${jsx};
23+
const ${componentName} = (props: Omit<IconBaseProps, 'name'>) => {
24+
return <IconBase name={${componentName}.name} {...props}><SvgIcon /></IconBase>
25+
}
26+
${exports};
27+
`;
28+
},
29+
};

0 commit comments

Comments
 (0)