Skip to content

Commit

Permalink
Add border support to the cover block
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronrobertshaw committed Apr 14, 2022
1 parent 5424ec0 commit c1fa1fe
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
12 changes: 12 additions & 0 deletions packages/block-library/src/cover/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,18 @@
"padding": true
}
},
"__experimentalBorder": {
"color": true,
"radius": true,
"style": true,
"width": true,
"__experimentalDefaultControls": {
"color": true,
"radius": true,
"style": true,
"width": true
}
},
"color": {
"__experimentalDuotone": "> .wp-block-cover__image-background, > .wp-block-cover__video-background",
"text": false,
Expand Down
10 changes: 8 additions & 2 deletions packages/block-library/src/cover/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
padding: 1em;
// This block has customizable padding, border-box makes that more predictable.
box-sizing: border-box;
// Overflow is hidden to handle border radius being applied on the block wrapper.
overflow: hidden;

&.has-parallax {
background-attachment: fixed;
Expand Down Expand Up @@ -39,14 +41,18 @@
* background-color class implies that another style will provide the background color
* for the overlay.
*
* The default background color has been moved to the before pseudo element
* to allow custom border styles. If left on the `.has-background-dim`
* element the color acts as a background to the dotted/dashed borders.
*
* See:
* - Issue with background color specificity: https://github.com/WordPress/gutenberg/issues/26545
* - Issue with alternative fix: https://github.com/WordPress/gutenberg/issues/26545
*/

// the first selector is required for old Cover markup
&.has-background-dim:not([class*="-background-color"]),
.has-background-dim:not([class*="-background-color"]) {
&.has-background-dim:not([class*="-background-color"])::before,
.has-background-dim:not([class*="-background-color"])::before {
background-color: $black;
}

Expand Down

0 comments on commit c1fa1fe

Please sign in to comment.