-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsvgr.config.js
37 lines (32 loc) · 945 Bytes
/
svgr.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// eslint-disable-next-line @typescript-eslint/no-var-requires
const dynamicTitlePlugin = require('./plugins/svg-dynamic-title-plugin');
const template = ({ componentName, jsx, props, imports, exports, interfaces }, { tpl }) =>
tpl`
${imports}
import {ViewBoxSize} from '../SVGIcon.types';
import styled from '@emotion/styled'
${interfaces}
const Base = ({ width, height, title, viewBox = '0 0 24 24', fill='none', ...props}: SVGProps\<
SVGSVGElement> &
{width: number | string, height:number | string, title: string, viewBox?:ViewBoxSize, fill?:string}) => {
return (${jsx})
}
export const ${componentName} = styled(Base)\`
& path {
fill: $\{({ fill }) => fill};
}
\`;
export default ${componentName};
`;
module.exports = {
template,
jsx: {
plugins: [dynamicTitlePlugin],
},
svgProps: {
height: '{height}',
width: '{width}',
fill: '{fill}',
viewBox: '{viewBox}',
},
};