diff --git a/source/wp-content/themes/wporg-showcase-2022/functions.php b/source/wp-content/themes/wporg-showcase-2022/functions.php index e9933073..e3e9f6a7 100644 --- a/source/wp-content/themes/wporg-showcase-2022/functions.php +++ b/source/wp-content/themes/wporg-showcase-2022/functions.php @@ -4,11 +4,31 @@ // Block files require_once( __DIR__ . '/src/site-screenshot/index.php' ); +require_once __DIR__ . '/inc/block-styles.php'; // Filters and Actions +add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\enqueue_assets' ); add_filter( 'jetpack_images_get_images', __NAMESPACE__ . '\jetpack_fallback_image', 10, 3 ); add_filter( 'jetpack_relatedposts_filter_thumbnail_size', __NAMESPACE__ . '\jetpackchange_image_size' ); + +/** + * Enqueue scripts and styles. + */ +function enqueue_assets() { + // The parent style is registered as `wporg-parent-2021-style`, and will be loaded unless + // explicitly unregistered. We can load any child-theme overrides by declaring the parent + // stylesheet as a dependency. + wp_enqueue_style( + 'wporg-showcase-2022-style', + get_stylesheet_directory_uri() . '/build/style/style-index.css', + array( 'wporg-parent-2021-style' ), + filemtime( __DIR__ . '/build/style/style-index.css' ) + ); + wp_style_add_data( 'wporg-showcase-2022-style', 'rtl', 'replace' ); + +} + /** * Retrieve the domain from post meta. * diff --git a/source/wp-content/themes/wporg-showcase-2022/inc/block-styles.php b/source/wp-content/themes/wporg-showcase-2022/inc/block-styles.php new file mode 100644 index 00000000..daf520fb --- /dev/null +++ b/source/wp-content/themes/wporg-showcase-2022/inc/block-styles.php @@ -0,0 +1,31 @@ + 'secondary-search-control', + 'label' => __( 'Secondary', 'wporg' ), + 'style_handle' => STYLE_HANDLE, + ) + ); +} diff --git a/source/wp-content/themes/wporg-showcase-2022/patterns/secondary-search-bar.php b/source/wp-content/themes/wporg-showcase-2022/patterns/secondary-search-bar.php new file mode 100644 index 00000000..abe741fc --- /dev/null +++ b/source/wp-content/themes/wporg-showcase-2022/patterns/secondary-search-bar.php @@ -0,0 +1,10 @@ + + + diff --git a/source/wp-content/themes/wporg-showcase-2022/src/index.js b/source/wp-content/themes/wporg-showcase-2022/src/index.js new file mode 100644 index 00000000..ffcf771b --- /dev/null +++ b/source/wp-content/themes/wporg-showcase-2022/src/index.js @@ -0,0 +1,2 @@ +// Noop, just imports the CSS for webpack. +import './index.js'; diff --git a/source/wp-content/themes/wporg-showcase-2022/src/style/block.json b/source/wp-content/themes/wporg-showcase-2022/src/style/block.json new file mode 100644 index 00000000..0869f98b --- /dev/null +++ b/source/wp-content/themes/wporg-showcase-2022/src/style/block.json @@ -0,0 +1,3 @@ +{ + "script": "file:./index.js" +} diff --git a/source/wp-content/themes/wporg-showcase-2022/src/style/index.js b/source/wp-content/themes/wporg-showcase-2022/src/style/index.js new file mode 100644 index 00000000..d0a6cc3b --- /dev/null +++ b/source/wp-content/themes/wporg-showcase-2022/src/style/index.js @@ -0,0 +1,2 @@ +// Noop, just imports the CSS for webpack. +import './style.scss'; diff --git a/source/wp-content/themes/wporg-showcase-2022/src/style/style.scss b/source/wp-content/themes/wporg-showcase-2022/src/style/style.scss new file mode 100644 index 00000000..1289ac13 --- /dev/null +++ b/source/wp-content/themes/wporg-showcase-2022/src/style/style.scss @@ -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; +} diff --git a/source/wp-content/themes/wporg-showcase-2022/templates/archive.html b/source/wp-content/themes/wporg-showcase-2022/templates/archive.html index 1541d602..4fe755c2 100644 --- a/source/wp-content/themes/wporg-showcase-2022/templates/archive.html +++ b/source/wp-content/themes/wporg-showcase-2022/templates/archive.html @@ -3,6 +3,7 @@
+
diff --git a/source/wp-content/themes/wporg-showcase-2022/templates/front-page.html b/source/wp-content/themes/wporg-showcase-2022/templates/front-page.html index 69467a0a..dc97742c 100644 --- a/source/wp-content/themes/wporg-showcase-2022/templates/front-page.html +++ b/source/wp-content/themes/wporg-showcase-2022/templates/front-page.html @@ -2,7 +2,7 @@
- +
diff --git a/source/wp-content/themes/wporg-showcase-2022/templates/search.html b/source/wp-content/themes/wporg-showcase-2022/templates/search.html index 4fd992ab..784681e9 100644 --- a/source/wp-content/themes/wporg-showcase-2022/templates/search.html +++ b/source/wp-content/themes/wporg-showcase-2022/templates/search.html @@ -3,6 +3,7 @@
+