Skip to content

Commit 1cd6ca5

Browse files
author
Simon Planinschek
committed
Add Refactored components to generator.js
1 parent 227673f commit 1cd6ca5

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

generator.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function formatName(string) {
4343
function componentTemplate(name, svg) {
4444
let component = "import React from 'react'\n"
4545
component += "import { IconProps } from './types'\n\n"
46-
component += `const ${name}: React.FC<IconProps> = (props) => (`
46+
component += `const ${name}: React.FC<IconProps> = ({ title = '${name}', ...props }) => (`
4747
component += svg + ')\n\n'
4848
component += `export { ${name} as default }`
4949

@@ -86,12 +86,7 @@ async function getSVGFile(icon, version) {
8686
.replace(/enable-background/g, 'enableBackground')
8787
.replace(/clip-rule/g, 'clipRule')
8888
.replace(/fill-rule/g, 'fillRule')
89-
.replace(
90-
'>',
91-
`><title>{props.title === undefined ? '${formatName(
92-
icon
93-
)}' : props.title}</title>`
94-
)
89+
.replace('>', '><title>{title}</title>')
9590
}
9691

9792
/**

0 commit comments

Comments
 (0)