Add onGetIconPath prop to IconSettings
Some consumers are having issues with displaying external SVGs due to CORS issues (icons are on a different server). The old path around this was inline icons. The plan is to remove inline icons at release v1.0 in order to simplify the icon logic. In it's place consumers can place SVGs inside their local page and then reference them with use.
With context, we can pass down the noCategoryPath prop to all icon children and remove the path string. this would cause
<svg aria-hidden="true" class="slds-button__icon slds-button__icon--small">
<use xlink:href="/assets/icons/utility-sprite/svg/symbols.svg#chevronright"></use>
</svg>
to become
<svg aria-hidden="true" class="slds-button__icon slds-button__icon--small">
<use xlink:href="#chevronright"></use>
</svg>
I don't know if there will be any collision to the multiple icon sets SLDS has. #utility-chevronright might be another option if there are issues in the future.
@pixelprodotco Please proof of concept this idea and see if it works with one icon AJAX'ed into the page. I will try to work on implementing it in DSR this week.
Sorry for the delay in getting back to this - got caught up in other tasks.
I can confirm the local svgs are working and have emailed you a link to a PR in our internal github for review. It is patched in right now, so if I'm your only use case - feel free to just close this issue and we have a very serviceable workaround in place as-is. If this is something you'd like to officially support, please implement on whatever time frame works for you and I'll adapt my implementation to yours when the time is right. :+1:
Thanks!
Update on issue @pixelprodotco
@elsigh of Quip and I have been talking about this. He needs this feature for loading SVGs from an CDN for the new Quip Live Apps.
He had the great suggestion to add an onGetIconPath function to IconSettings that returns a string into the SVG href, so you can do whatever you want such as #down. You'll get the category and name passed in an args object and return a string.
@elsigh I'm leaning toward putting the onGetIconPath first in the conditional statement over the path string, sprite props, since it's the new prop--if you think that is the best way.