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

[Style Book] Allow the possibility to show multiple variations of the same block #47443

Open
gigitux opened this issue Jan 26, 2023 · 10 comments
Assignees
Labels
[Feature] Extensibility The ability to extend blocks or the editing experience Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.

Comments

@gigitux
Copy link
Contributor

gigitux commented Jan 26, 2023

What problem does this address?

In WooCommerce Blocks, there is a block called Filter Wrapper. This block has multiple variations: Filter by Stock, Filter by Attribute, Filter by Rating and Active Filers (source code). As all the variations, based on the attributes, it renders a specific variation.
With the Style Book, it seems there isn't the possibility of showing multiple variations of the same block.

What is your proposed solution?

A good solution is to have the possibility to show multiple variations of the same block on Style Book.

@annezazu annezazu added [Type] Enhancement A suggestion for improvement. Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json labels Jan 26, 2023
@annezazu
Copy link
Contributor

Great issue! @noisysocks for consideration. I imagine there's not enough time for 6.2 but this seems like a good thing to iterate on for 6.3, especially since you can edit style variations now: #46343

@annezazu annezazu added the [Feature] Extensibility The ability to extend blocks or the editing experience label Jan 26, 2023
@Aljullu
Copy link
Contributor

Aljullu commented Jan 27, 2023

I might be confused, but I think you are referring to two different concepts:

If I'm not wrong, they are two different concepts, no?

@gigitux
Copy link
Contributor Author

gigitux commented Jan 27, 2023

Thanks for clarifying, @Aljullu! You are right. I'm referring to block variations.

@noisysocks
Copy link
Member

Sounds like a good idea. Should Style Book aways show all block variations? If not, how should blocks opt-in (or opt-out?) of this behaviour?

@noisysocks
Copy link
Member

cc. @tellthemachines who I think is the variations expert 😀

@tellthemachines
Copy link
Contributor

I did some work on style variations recently, but I don't think that's what this is about! Not sure how we're listing the blocks for the Style Book... could we look up their variations and render them all? for instance, it would make sense to have Row and Stack but we only have Group.

@bfintal
Copy link
Contributor

bfintal commented Mar 20, 2023

I'm looking forward to this too. In my case, I have a Button Group block, that has variations in the inserter for Icon Button and Social Buttons - so they feel like normal blocks because you can insert them like normal blocks and you also have a preview example like normal. It just felt odd that they weren't included in the Style Book also.

@noisysocks the opt-in can be similar to how it's done with normal blocks: if the scope is inserter and there's an example given.

@warudin
Copy link

warudin commented Jul 28, 2023

Yeah, I have almost the same situation as @bfintal. I made different blockVariations of the core/button block and supposed them to be available in the Style Book. But at the moment this is not the case, unfortunately. I'm looking forward to any improvements on this, that would be so helpful.

@fabiankaegy
Copy link
Member

As stated before there are a few different concepts that can all be used for very different things. Not all block variations should actually show up in the style book because they aren't all related to styling.

When @youknowriad built his Blockbook it came with this cool concept called "stories" which allowed anyone to define different configurations of a block which would the show up in the style book.

I think a mechanism like that would go much further because it would allow extenders and theme developers to also add more complex things like inner block structures in the stylebook so that you can easily see the effects your changes have on these different instances of the blocks.

This concept of Stories comes from Storybook where it is the foundation for all of the elements that get displayed. https://storybook.js.org/docs/react/writing-stories/introduction

@gziolo
Copy link
Member

gziolo commented Nov 23, 2023

It's potentially related to this issue reported on the WordPress forum: https://wordpress.org/support/topic/wp-social-link-mail-colour/.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Extensibility The ability to extend blocks or the editing experience Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

9 participants