bookshop icon indicating copy to clipboard operation
bookshop copied to clipboard

Make it possible for a component to have a wrapper class

Open Robbie-Cook opened this issue 4 years ago • 2 comments

It would be great if we could have a custom wrapper for a single component if we want.

I think others would be interested in this too.

In traditional storybook this is something I do quite a lot. For example, for a full-width button, I want to have a wrapper class to demonstrate that the button is bigger.

Maybe this is something we could add to [meta]?

e.g.

[meta]
wrapper = """

<div class="big-iron"></div>

"""

And styles can be defined in .storybook/styles.scss.

Any thoughts @bglw ?

Robbie-Cook avatar Jan 14 '21 23:01 Robbie-Cook

I'm hesitant to add too much more to the TOML file, as it serves primarily as documentation and CloudCannon config, and is sitting on the border of readability as it is.

I'll have a think on how to set this up in a sane way - it will likely be the trigger for a second config file specific to meta (and will come after we finish the refactor)

bglw avatar Jan 15 '21 04:01 bglw

This could now be solved in some cases by wrapping the entire bookshop renderer in a class. There's still some value in this issue for wrapping a component in a class on the fly.

bglw avatar Jul 01 '21 02:07 bglw