-
Notifications
You must be signed in to change notification settings - Fork 0
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
[BBT-98] Adds support for variation styling #106
base: release/1.0.0
Are you sure you want to change the base?
Conversation
Awesome @chrishall0 this is really useful! Might be something to look at with the button block itself here and the way the styles are nested, but there doesn't seem to be a way to target the hover state of the outline variation: I wonder if we'd need to change the UI slightly in order to style all states within a different button variation? |
hey @jonnywatersbb, i've been doing some more digging into this and i'm not sure it's going to be possible currently. Looking at the theme.json schema we can define any variations styling within the 'blocks' subsection of the styles section, however any styling for pseudo styles are defined within the 'elements' subsection instead, which does not support 'variations'. So therefore I think you can't currently style a pseudo state for a particular variation within the theme.json. @g-elwell I think you mentioned something around this in the ticket, just wanted to loop you in incase i've missed something. I believe this current open issue on the Gutenberg repo might be relevant WordPress/gutenberg#59731 I'm going to draft this actually, because I want to make some changes and move this to be accessed via the sidebar rather than where it is currently. |
Yeah this makes sense to me and is unfortunately a limitation of how Gutenberg and theme.json are working currently. The way blocks are styled makes things mega confusing with buttons in particular (which is where this is likely to be most used!) Disregarding variations for a sec, if you style the |
** Note for reviewer - unsure what release this will be a part of, so i've put it as
release/1.0.0
for now but happy to change this if required **#98 Implements Variation styles editing within Themer.
Description
#98
This ticket implements functionality to change 'variations' values within blocks that support this. Further info regarding variations and which blocks are support is here https://developer.wordpress.org/news/2023/05/26/customizing-core-block-style-variations-via-theme-json/
I'm using twentytwentythree to test and by default WordPress seems to have variation values available for the Button component and the Site-Title component, the rest of the blocks will need values adding to the Theme.json files with the supported core name.
Please note as per ticket, custom variations are not currently supported so will not render. The button blocks supports two different variations so we can use this to test the tabpanel implementation. I've attached a copy of my theme.json below to assist testing this.
This PR also adds in menu options for elements and variations underneath the selected block. Changes have been made to the navigator block and code block logic to account for this.
Change Log
Steps to test
Select a block such as the core/button block within Themer and use the menu to get to the variations options. Edit these and then within the post editor, check that these have been reflected when adding the respective block and choosing the edited style variation.
Below is a copy of my button component within my theme.json to assist any testing
Screenshots/Videos
http://bigbite.im/v/oa1pNt
Checklist: