Skip to content
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

Can we please avoid those redundant Svelte's wrappers? #14366

Closed
frederikhors opened this issue Mar 28, 2021 · 4 comments
Closed

Can we please avoid those redundant Svelte's wrappers? #14366

frederikhors opened this issue Mar 28, 2021 · 4 comments

Comments

@frederikhors
Copy link

Thanks for your amazing, delicious work on Storybook!!!

Is your feature request related to a problem? Please describe
I'm trying Storybook for the first time and with Svelte.

Using kitchen-sink example here I find it very inconvenient to create "wrappers" (such as ButtonView.svelte) because it becomes a tedious repetition of the component itself.

Example:

A button has primary and size (and many other) props and I need to put them both in ButtonView.svelte and the real Button.svelte component to use it in Storybook.

Why this? Could it be because it is complicated to inject slots?

Maybe I'm wrong in using it like this?

Describe the solution you'd like
I would like to "directly" use Button.svelte in my button.stories.js without ButtonView.svelte wrapper.

Maybe we can use an object like this:

import DefaultSlot from "./DefaultSlot.svelte"
import FirstSlot from "./FirstSlot.svelte"
{
  slots: {
    default: { component: DefaultSlot }
    first: { component: FirstSlot }
  }
}

What do you think, Svelte guys? 😄

@j3rem1e
Copy link
Contributor

j3rem1e commented Mar 28, 2021

Check this plugin: https://www.npmjs.com/package/@storybook/addon-svelte-csf

It allows to write stories directly in svelte syntax.

@frederikhors
Copy link
Author

@j3rem1e thank you! Interesting! I'm studying...

@shilman, can I ask you to not close this issue until we found a comfortable way to write Svelte stories?

@shilman
Copy link
Member

shilman commented Mar 28, 2021

@frederikhors sure thing. i'll let you close it when it's answered to your satisfaction

@frederikhors
Copy link
Author

@j3rem1e, @shilman it works amazing! Thanks!

Is there more extensive documentation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants