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

Adding a wrapper in the style guide #86

Open
ChristineP2 opened this issue Feb 23, 2019 · 3 comments
Open

Adding a wrapper in the style guide #86

ChristineP2 opened this issue Feb 23, 2019 · 3 comments

Comments

@ChristineP2
Copy link
Contributor

Hey, sorry I haven't had any PRs recently, work is intense.

I've been pondering how useful it would be to be able to have the ability to insert the example into a partial in the style guide.

So, if you wanted to show how a complex form component would display within your simple_form, you could create a partial with the form setup, then display the example within that partial.

Would that make sense to add? All I could think of was using content_for to capture the sample component and if there was a partial, that would use the capture, if there wasn't a partial, then we'd display the content_for directly.

I am sure there are other options as well, what thoughts do you have on this one?

@kitop
Copy link
Collaborator

kitop commented Feb 24, 2019

This is a very interesting proposition and can potentially solve a bunch of issues! :) Thanks for proposing this! And no worries at all about PRs, there's no pressure and life's busy!

Do you have any ideas how the final API could look like, from the user perspective? Like, how would an example with this wrapper look like in the yaml?

I'm trying to think how the easiest way for the user to do this without interfering with regular component usage in your views. I'll give it some thought as well and come up with a few options, but curious to know how you envision this from the user perspective, as it's a great idea!

@ChristineP2
Copy link
Contributor Author

ChristineP2 commented Mar 11, 2019

I was going to try out a theory tonight, but I ended up fussing with the demo app for quite some time after re-checking it out. I forgot I had to update pg to 1.1.3 in order for it to work on windows (in addition to adding tz-info).

My current theory is that I'll be looking for the key partial within the mv_stub_meta. If the key is present and has a valid partial, the component would be loaded into content_for :mv_component, and the partial would be rendered with the expectation that it will load :mv_component in content_for. If there was not a partial in mv_stub_meta the component would be rendered as it is now. I believe I may have to use the index number for the loop and send that into the partial in order to make it unique... but I'd like to give it a try to work out the details...

@ChristineP2
Copy link
Contributor Author

I made a PR (#88) with the general concept I was going for. Let me know what you think

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