WordPress / wporg-parent-2021

21 stars 11 forks source link

Block Styles: Add the Secondary Search block style on search block #61

Closed ryelle closed 2 years ago

ryelle commented 2 years ago

The secondary search style is needed for the documentation site as well as showcase, so this PR moves the code from showcase to the parent theme.

I made a few changes to the styles in converting the CSS to Sass, the biggest change was remove !important when it wasn't necessary, and setting the custom properties for the button colors so the interactive states still work.

Lastly, I added a local custom prop for the border color, since documentation uses a light grey border, this way it can be set like this, to apply to all the borders.

.wp-block-search.is-style-secondary-search-control {
    --local--border-color: var(--wp--preset--color--light-grey-1);
}

Screenshots

Style is available on any site using the parent theme

Screenshot 2022-11-30 at 1 54 36 PM

The variations of the search block with Secondary style

Screenshot 2022-11-30 at 1 51 12 PM

In context on showcase

Screenshot 2022-11-30 at 1 41 27 PM

How to test the changes in this Pull Request:

  1. Add a search block to a page or template, you should see the Secondary style option
  2. Apply the style, the block should match the screenshots above (the editor view doesn't totally match, check frontend only)
  3. Try with the showcase PR TBD, there should be no visual change on showcase.
StevenDufresne commented 2 years ago

We should transfer over https://github.com/WordPress/wporg-parent-2021/issues/62 when this merges.