react-game-icons
Version:
React SVG elements for game-icons.net collection of icons
20 lines (17 loc) • 727 B
Markdown
react-game-icons
find 1x1 -mindepth 2 -type f -exec mv -iy '{}' svgs/ ';'
rm -rf react
mkdir react
npx @svgr/cli --template template.js -d react svgs/
printf "import React from 'react';" > react/0000import.js
cat react/* > paths.ts
rm react/0000import.js
printf "import React from 'react';\nimport * as paths from './paths';\n\nexport class SvgWrapper : (any) => React.FC = (Element) => (props : React.SVGProps) => <Element {...props} />;\n\n" > tmp000.js
ls react/ | xargs -n 1 basename | cut -d. -f1 | awk $'{print "export const "$1" : React.FC = SvgWrapper(paths.Svg"$1");"}' > tmp001.js
cat tmp*.js > index.ts
rm tmp001.js
rm tmp000.js
---
find a way to get rid of {..props} in paths
---
tsc -d --jsx react src/index.tsx