-
Notifications
You must be signed in to change notification settings - Fork 6
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
Add Searchbar Pattern/Block Styles #25
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
50a99de
Add a style variation to handle secondary search bar.
StevenDufresne 11b2fa3
Update the pattern name.
StevenDufresne 098e282
Enqueue styles.
StevenDufresne f6dd6af
Translate label.
StevenDufresne 1edd221
Add in pattern to files with patterns.
StevenDufresne 3676749
Support more of the searchbar type layouts.
StevenDufresne a3ccedb
Remove commented out lines.
StevenDufresne 080be58
Some more style fixes.
StevenDufresne 960b460
Fix linter error.
StevenDufresne a1dc1c2
Remove label from searchbar.
StevenDufresne File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
source/wp-content/themes/wporg-showcase-2022/inc/block-styles.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
/** | ||
* Block Styles & Variations | ||
* | ||
* Load the CSS, JS, and register custom styles. | ||
*/ | ||
|
||
namespace WordPressdotorg\Theme\Showcase_2022\Block_Styles; | ||
|
||
defined( 'WPINC' ) || die(); | ||
|
||
const STYLE_HANDLE = 'wporg-showcase-block-styles'; | ||
|
||
/** | ||
* Actions and filters. | ||
*/ | ||
add_action( 'init', __NAMESPACE__ . '\setup_block_styles' ); | ||
|
||
/** | ||
* Add our custom block styles & class names. | ||
*/ | ||
function setup_block_styles() { | ||
register_block_style( | ||
'core/search', | ||
array( | ||
'name' => 'secondary-search-control', | ||
'label' => __( 'Secondary', 'wporg' ), | ||
'style_handle' => STYLE_HANDLE, | ||
) | ||
); | ||
} |
10 changes: 10 additions & 0 deletions
10
source/wp-content/themes/wporg-showcase-2022/patterns/secondary-search-bar.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
/** | ||
* Title: Secondary Search Bar | ||
* Slug: wporg-showcase-2022/secondary-search-bar | ||
* Categories: wporg | ||
*/ | ||
|
||
?> | ||
|
||
<!-- wp:search {"showLabel":false,"placeholder":"<?php esc_attr_e( 'Search sites...', 'wporg' ); ?>","width":100,"widthUnit":"%","buttonText":"Search","buttonPosition":"button-inside","buttonUseIcon":true,"className":"is-style-secondary-search-control"} /--> | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// Noop, just imports the CSS for webpack. | ||
import './index.js'; |
3 changes: 3 additions & 0 deletions
3
source/wp-content/themes/wporg-showcase-2022/src/style/block.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"script": "file:./index.js" | ||
} |
2 changes: 2 additions & 0 deletions
2
source/wp-content/themes/wporg-showcase-2022/src/style/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// Noop, just imports the CSS for webpack. | ||
import './style.scss'; |
72 changes: 72 additions & 0 deletions
72
source/wp-content/themes/wporg-showcase-2022/src/style/style.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
* Note: only add styles here in cases where you can't achieve the style with | ||
* templates or theme.json settings. | ||
*/ | ||
|
||
/* | ||
* Block styles. | ||
*/ | ||
|
||
/* | ||
* core/search. | ||
*/ | ||
|
||
.is-style-secondary-search-control { | ||
display: flex; | ||
align-items: center; | ||
} | ||
|
||
.is-style-secondary-search-control > label { | ||
flex: 0; | ||
font-size: var(--wp--preset--font-size--extra-small) !important; | ||
padding-right: var(--wp--preset--spacing--10) !important; | ||
} | ||
|
||
.is-style-secondary-search-control input[type="search"] { | ||
border: none !important; | ||
font-size: var(--wp--preset--font-size--extra-small) !important; | ||
padding: 0 var(--wp--preset--spacing--10) !important; | ||
} | ||
|
||
.wp-block-search__no-button.is-style-secondary-search-control input[type="search"] { | ||
min-height: var(--wp--preset--spacing--40); | ||
border: 1px solid var(--wp--preset--color--charcoal-1) !important; | ||
} | ||
|
||
.wp-block-search__button-inside.is-style-secondary-search-control .wp-block-search__inside-wrapper { | ||
border: 1px solid var(--wp--preset--color--charcoal-1) !important; | ||
border-radius: 2px !important; | ||
} | ||
|
||
.wp-block-search__button-outside.is-style-secondary-search-control input[type="search"] { | ||
border: 1px solid var(--wp--preset--color--charcoal-1) !important; | ||
border-radius: 2px !important; | ||
} | ||
|
||
.wp-block-search__button-outside.is-style-secondary-search-control button[type="submit"] { | ||
border: 1px solid var(--wp--preset--color--charcoal-1) !important; | ||
} | ||
|
||
.is-style-secondary-search-control button[type="submit"] { | ||
background-color: transparent !important; | ||
color: var(--wp--preset--color--charcoal-1) !important; | ||
} | ||
|
||
.is-style-secondary-search-control button[type="submit"] svg { | ||
fill: var(--wp--preset--color--charcoal-1) !important; | ||
} | ||
|
||
.wp-block-search__icon-button.is-style-secondary-search-control button[type="submit"] { | ||
padding: calc(var(--wp--preset--spacing--10) / 2) !important; | ||
} | ||
|
||
.wp-block-search__text-button.is-style-secondary-search-control button[type="submit"] { | ||
border: 1px solid var(--wp--preset--color--charcoal-1) !important; | ||
font-size: var(--wp--preset--font-size--extra-small) !important; | ||
padding: var(--wp--preset--spacing--10) !important; | ||
} | ||
|
||
.wp-block-search__button-inside.is-style-secondary-search-control | ||
button[type="submit"] { | ||
margin: 2px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"showLabel":false
hides the label visually, but it's still there in the content (using the default label, "Search"), so the feedback about the overly verbose placeholder from here still applies.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should have verified. Thanks.