From 293831edb47e1a3700fc71cb034407e3ac029222 Mon Sep 17 00:00:00 2001 From: Kelly Dwan Date: Fri, 5 Apr 2024 13:33:04 -0400 Subject: [PATCH] Block styles: Add dots spacer style to parent theme These dot spacers were initially used on Showcase, but have been added as accents to other sites in various ways. To keep things DRY, this creates a block style for all sites to use, using SVG images for crisp circles at all screen sizes. --- .../wporg-parent-2021/images/dots-banner.svg | 44 +++++++++++ .../images/dots-blue-banner.svg | 71 ++++++++++++++++++ .../images/dots-dark-banner.svg | 75 +++++++++++++++++++ .../wporg-parent-2021/inc/block-styles.php | 27 +++++++ .../wporg-parent-2021/sass/block-styles.scss | 22 ++++++ 5 files changed, 239 insertions(+) create mode 100644 source/wp-content/themes/wporg-parent-2021/images/dots-banner.svg create mode 100644 source/wp-content/themes/wporg-parent-2021/images/dots-blue-banner.svg create mode 100644 source/wp-content/themes/wporg-parent-2021/images/dots-dark-banner.svg diff --git a/source/wp-content/themes/wporg-parent-2021/images/dots-banner.svg b/source/wp-content/themes/wporg-parent-2021/images/dots-banner.svg new file mode 100644 index 00000000..3bbe212b --- /dev/null +++ b/source/wp-content/themes/wporg-parent-2021/images/dots-banner.svg @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/source/wp-content/themes/wporg-parent-2021/images/dots-blue-banner.svg b/source/wp-content/themes/wporg-parent-2021/images/dots-blue-banner.svg new file mode 100644 index 00000000..f65d665c --- /dev/null +++ b/source/wp-content/themes/wporg-parent-2021/images/dots-blue-banner.svg @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/source/wp-content/themes/wporg-parent-2021/images/dots-dark-banner.svg b/source/wp-content/themes/wporg-parent-2021/images/dots-dark-banner.svg new file mode 100644 index 00000000..44d95394 --- /dev/null +++ b/source/wp-content/themes/wporg-parent-2021/images/dots-dark-banner.svg @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/source/wp-content/themes/wporg-parent-2021/inc/block-styles.php b/source/wp-content/themes/wporg-parent-2021/inc/block-styles.php index 4906894a..fd81ba68 100644 --- a/source/wp-content/themes/wporg-parent-2021/inc/block-styles.php +++ b/source/wp-content/themes/wporg-parent-2021/inc/block-styles.php @@ -207,6 +207,33 @@ function setup_block_styles() { 'style_handle' => STYLE_HANDLE, ) ); + + register_block_style( + 'core/spacer', + array( + 'name' => 'dots-background', + 'label' => __( 'Dots', 'wporg' ), + 'style_handle' => STYLE_HANDLE, + ) + ); + + register_block_style( + 'core/spacer', + array( + 'name' => 'blue-dots-background', + 'label' => __( 'Dots (blue)', 'wporg' ), + 'style_handle' => STYLE_HANDLE, + ) + ); + + register_block_style( + 'core/spacer', + array( + 'name' => 'dark-dots-background', + 'label' => __( 'Dots (dark)', 'wporg' ), + 'style_handle' => STYLE_HANDLE, + ) + ); } /** diff --git a/source/wp-content/themes/wporg-parent-2021/sass/block-styles.scss b/source/wp-content/themes/wporg-parent-2021/sass/block-styles.scss index e287d7d8..1b97be74 100644 --- a/source/wp-content/themes/wporg-parent-2021/sass/block-styles.scss +++ b/source/wp-content/themes/wporg-parent-2021/sass/block-styles.scss @@ -576,3 +576,25 @@ .is-style-list-long-items > li { margin-bottom: var(--wp--preset--spacing--20); } + +.wp-block-spacer { + &.is-style-dots-background, + &.is-style-dark-dots-background, + &.is-style-blue-dots-background { + background-position: top center; + background-repeat: repeat-x; + background-size: auto; + } + + &.is-style-dots-background { + background-image: url(../images/dots-banner.svg); + } + + &.is-style-blue-dots-background { + background-image: url(../images/dots-blue-banner.svg); + } + + &.is-style-dark-dots-background { + background-image: url(../images/dots-dark-banner.svg); + } +} \ No newline at end of file