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
I can see the value of custom render functions, but their implementation varies depending on the framework. For example, React’s render functions return a JSX element, Vue’s render functions return an object and you cannot use Vue SFC in it, while Svelte doesn’t support render functions (since you cannot represent a Svelte component as a function). Because of that, it requires quite a lot of work to support render functions for different frameworks in Astrobook.
In the meantime, you can create your own wrapper component for showing mobile and desktop versions. Here is an example:
// MyComponent.tsx// You actual componentexportdefaultfunctionMyComponent(){return<div>...</div>}
// MyComponentRendering.tsx// A component that wraps MyComponent with different size of containers.exportdefaultfunctionMyComponentRendering({size}: {size: 'mobile'|'desktop'}){if(size==='mobile'){return<divstyle={{maxWidth: "400px"}}><MyComponent/></div>}else{return<divstyle={{maxWidth: "1200px"}}><MyComponent/></div>}}
Hi,
I really love this project, and i hope i can contribute in this project next time (i'm not confident enough with my skill).
I have a request, could you add custom render function as inputs in stories? like this one https://storybook.js.org/docs/api/csf#custom-render-functions.
The reasons are i need to show the mobile and desktop version of my component.
Thank you.
The text was updated successfully, but these errors were encountered: