Skip to content

Commit

Permalink
Block styles: Add dots spacer style to parent theme
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ryelle committed Apr 5, 2024
1 parent 624ac76 commit 293831e
Show file tree
Hide file tree
Showing 5 changed files with 239 additions and 0 deletions.
44 changes: 44 additions & 0 deletions source/wp-content/themes/wporg-parent-2021/images/dots-banner.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions source/wp-content/themes/wporg-parent-2021/inc/block-styles.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
);
}

/**
Expand Down
22 changes: 22 additions & 0 deletions source/wp-content/themes/wporg-parent-2021/sass/block-styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

0 comments on commit 293831e

Please sign in to comment.