Closed frassinier closed 1 year ago
type: "figspec"
already does the job: it fetches design spec as images then renders them.
However considering your requirements, I believe creating a simple React component (FigmaImage
in your code example) then importing it from docs page is the simplest and cleanest solution. You do not need an addon for using custom component inside docs pages.
https://storybook.js.org/docs/react/writing-docs/docs-page#with-a-custom-component
Is your feature request related to a problem? Please describe.
I want to add Figma images, just images, like any other images, into MDX files that are used for documentation purposes (using addon-docs). To do so, I would like to contribute a new docs block. But I need help, please!
The goal is to pass a custom JSX tag into my Storybook docs MDX file and see an image generated by Figma directly.
Describe the solution you'd like
Using figma-js.
where
FigmaContext.tsx
isand the service worker,
figma-image-sw.js
:Then I would like to add this piece of code to the README of the repo:
3. Add it to docs!
Describe alternatives you've considered
Don't want to create a new addon for that.
Design types
figma
figspec
link
image
iframe