You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a new Graphic component that pulls SVGs from a URL instead of injecting the graphic as inner HTML within the component.
Motivation
Allow our consumers to pull assets from a CDN instead of our graphics package
Assets can be cached by the browser and are only pulled in on request instead of bloating their app bundle
Move away from using __dangerouslySetInnerHTML
Opens the option to easily support PNGs
We could also refactor the existing Graphic component, but I think it's a better idea to add this to canvas-kit-preview-react and allow consumers to adjust over time. Adding a new component would also allow us to roll this out to teams sooner.
Example
The API could look something like this:
<GraphicimageName="empty-state-critical"/>
🗒️ We would still need to figure out how to elegantly handle setting the base URL for various consumers and environments.
Under the hood, we would use set the imageName as a CSS var in our stencil and pass it along to the backgroundImage.
🚀 Feature Proposal
Create a new Graphic component that pulls SVGs from a URL instead of injecting the graphic as inner HTML within the component.
Motivation
__dangerouslySetInnerHTML
We could also refactor the existing Graphic component, but I think it's a better idea to add this to
canvas-kit-preview-react
and allow consumers to adjust over time. Adding a new component would also allow us to roll this out to teams sooner.Example
The API could look something like this:
Under the hood, we would use set the
imageName
as a CSS var in our stencil and pass it along to thebackgroundImage
.Open to discussion on this. 😄
The text was updated successfully, but these errors were encountered: