tomusborne / generateblocks

GenerateBlocks is a small collection of lightweight WordPress blocks that can accomplish nearly anything.
https://generateblocks.com
198 stars 23 forks source link

2.0a Default Button/Icon styles #1494

Closed Kovas closed 17 hours ago

Kovas commented 5 days ago

Dealing with default button and icon styles is frustrating. Every time I create a button, I have to apply my own class and remove the pre-set block styles. The same issue happens with icons—adding an icon overrides my existing button class settings, like gap and some other settings.

Wouldn't it be better to have an option in the GB settings to define a default button class? As for icon styles, perhaps an option to disable default styling would be a good solution, though I'm not sure what the best approach is.

tomusborne commented 4 days ago

Dealing with default button and icon styles is frustrating. Every time I create a button, I have to apply my own class and remove the pre-set block styles.

I agree, this is annoying. I'd like to add a simple PHP filter that allows you to set the default attributes of the Button variation. This would allow you to set a Global Style by default and skip all of the other attributes.

adding an icon overrides my existing button class settings, like gap and some other settings.

This shouldn't happen. We specifically check to see if those options don't already have a value before setting them. Logging this as a bug so we can look into it.

tomusborne commented 17 hours ago

The filter above is now in GB2, so you can filter the default attributes for the Button block.

Example here: https://github.com/tomusborne/generateblocks/pull/1503