-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Icons test #1466
base: master
Are you sure you want to change the base?
Icons test #1466
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1466 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 96 97 +1
Lines 1703 1604 -99
Branches 477 452 -25
=========================================
- Hits 1703 1604 -99 see 14 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
8d95827
to
a6876e0
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
"generate-icon-names": "node icons/src/generateIconNames.js", | ||
"convert-icons": "npm run clean-icons && npx @svgr/cli --out-dir icons/src/react --ext=jsx --template=icons/template.js --expand-props=none --svg-props width={size} --svg-props height={size} --replace-attr-values=#5a5a5a={color},#333={color},currentColor={color} -- icons/src/svg && npm run generate-icon-names", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the main transformation script.
We don't need the generate-icon-names
script if we choose to not use the <Icon name="..."/>
component.
The main thing to note here is
--replace-attr-values=#5a5a5a={color}
if all the source svgs have the same fill colour (e.g #5a5a5a
), we can use this to replace the fill with currentColor
string or a {color}
prop.
the template.js file has the markup for the props etc.
Description
This PR is for testing only, to make cleaning up existing icon svgs easier. Icons won't necessarily be in this repo.
icons/src/svg
are converted to react componentscurrentColor
(currently as color prop that would be overridable; tbd)size
prop that maps to svg width and heightsvg-icon
default className andclassName
propThese could be used directly:
or
These would be used like this:
not sure of the best API here, but a few things to consider/investigate