WordPress / wporg-parent-2021

17 stars 10 forks source link

Add styles for small, toggle and tertiary buttons #112

Closed adamwoodnz closed 11 months ago

adamwoodnz commented 11 months ago

Closes #111

Adds 3 style variations:

I've made Tertiary and Toggle small by definition, based on their semantics and usage in the Developer designs, and to avoid the complexity in supporting both large and small. We can add these variations if need be later.

Screenshots

States

State
Static Screenshot 2023-10-02 at 3 40 43 PM
Hover Screenshot 2023-10-02 at 3 41 08 PM
Focus Screenshot 2023-10-02 at 3 41 37 PM
Active Screenshot 2023-10-02 at 4 00 18 PM
Active Focus Screenshot 2023-10-02 at 3 59 55 PM

Developer

Screenshot 2023-10-02 at 4 08 28 PM

How to test the changes in this Pull Request:

  1. Test it with https://github.com/WordPress/wporg-developer/pull/292, the filters and version selector use all these styles
  2. Create buttons in the editor and apply the style variations
jasmussen commented 11 months ago

Looks good.

Small pet peeve, is it too late to rename "Tertiary" to "Text"? The former suggests a hierarchy where none exists. If we can't, that's fine.

ryelle commented 11 months ago

I second the suggestion to rename "tertiary" to "text," that describes the button better too.

Perhaps a question for design, will we need small/toggle/tertiary variations on dark backgrounds? Or small outline buttons? Large text buttons?

Since variations can't combine, we'd need to create potentially 16 individual variations: [default, outline, text, toggle] * [small, normal] * [on dark, on light] … and this picker already feels like a lot 😅

Screenshot 2023-10-03 at 6 18 00 PM

If we might need more, maybe we could have toggles or something, like the isSmall prop on the GB button.

Screen Shot 2023-10-03 at 18 24 32

We can't go back on the "Default/Filled on dark" "Outline/Outline on dark" split, because those are already in use on production… but even just helper class that can be manually applied might help.

Screenshot 2023-10-03 at 6 13 54 PM
jasmussen commented 11 months ago

Perhaps a question for design, will we need small/toggle/tertiary variations on dark backgrounds? Or small outline buttons? Large text buttons?

I don't think so. At the moment, the Theme Directory is dark, but it's not using the toggles:

Screenshot 2023-10-04 at 09 39 20

Screenshot 2023-10-04 at 09 39 29

adamwoodnz commented 11 months ago

even just helper class that can be manually applied might help

Yeah I did consider whether this needed to be something exposed in the editor. If we go with the is-small helper class, should the Toggle and Text variations be defined large by default as well then?

adamwoodnz commented 11 months ago

should the Toggle and Text variations be defined large by default as well then?

I think so, otherwise the size difference would be unexpected. I've made this change now, so there are less variations:

Screenshot 2023-10-05 at 12 15 38 PM

Frontend: