-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from WordPress/add/searchbar-pattern
- Loading branch information
Showing
10 changed files
with
143 additions
and
1 deletion.
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