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

Rendering multiple view components in a story #70

Closed
KonnorRogers opened this issue Jul 20, 2021 · 3 comments
Closed

Rendering multiple view components in a story #70

KonnorRogers opened this issue Jul 20, 2021 · 3 comments
Milestone

Comments

@KonnorRogers
Copy link
Contributor

Im curious if theres a way to render multiple components in a single story.

Component.with_collection(posts)

is what im using in my app, but I cant find any prior art on how to render multiple components like with a collection. I tried calling constructor twice, but it only takes the last instance.

I know i could swap to just passing in a collection, but I was curious if there was a nicer way to do this.

@jonspalmer
Copy link
Owner

We don't have support for that at the moment. We are mirroring the Preview feature in ViewComponent (and in turn Rails Mailer previews) with is very much single component focused.

If we did add it its not clear how we'd format the list in HTML etc and it would also be harder to figure out how to pass control values to them. Of course if you have a higher level component that renders a list of components (perhaps as a render_many slot) then we'd support that well.

@jonspalmer
Copy link
Owner

Circling back to this conversation I'm curious if you have thoughts on the discussion in #150

@jonspalmer jonspalmer added this to the 1.0.0 milestone Jan 7, 2023
@jonspalmer
Copy link
Owner

fixed in v1.0.0

Storeis are not just ViewComponent Previews. Using custom templates you can now render multiple Components.

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

No branches or pull requests

2 participants