️ (icons-styled-components): add icon role

This commit is contained in:
JiangWeixian 2020-03-27 11:00:20 +08:00
parent e3cff55f45
commit f10409eccd
2 changed files with 2 additions and 1 deletions

View File

@ -13,6 +13,7 @@ Object.keys(icons).forEach(k => {
const result = mustache.render(iconsTpl.toString(), {
styledname: `Styled${name}`,
name,
originalname: k,
css,
})
fs.outputFileSync(path.resolve(__dirname, `../src/icons/${name}.tsx`), result)

View File

@ -8,7 +8,7 @@ const {{ styledname }} = styled.i`
export const {{ name }} = React.forwardRef<HTMLElement, React.HTMLAttributes<HTMLElement>>((props, ref) => {
return (
<>
<{{ styledname }} {...props} ref={ref} />
<{{ styledname }} {...props} ref={ref} icon-role="{{originalname}}" />
</>
)
})