Skip to content

Commit

Permalink
Add specific CSS to deal with cover, column and group blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
scruffian committed May 17, 2022
1 parent 663cbd3 commit 6bdf2fa
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
2 changes: 0 additions & 2 deletions lib/compat/wordpress-6.1/class-wp-theme-json-6-1.php
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,6 @@ protected static function additional_root_selector_rules( $selector, $theme_json
{ padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }';

$block_rules .= '.wp-site-blocks .alignfull { margin-right: calc(var(--wp--style--root--padding-right) * -1); margin-left: calc(var(--wp--style--root--padding-left) * -1); width: unset; }';
$block_rules .= '.alignfull .alignfull { margin-right: 0; margin-left: 0; }';

// Alignfull blocks in the block editor that are direct children of post content should also get negative margins.
if ( is_callable( 'get_current_screen' ) && get_current_screen()->is_block_editor() ) {
Expand All @@ -293,7 +292,6 @@ protected static function additional_root_selector_rules( $selector, $theme_json
{ padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }';

$block_rules .= '.is-root-container .wp-block.alignfull { margin-right: calc(var(--wp--style--root--padding-right) * -1); margin-left: calc(var(--wp--style--root--padding-left) * -1); max-width: unset; width: unset; }';
$block_rules .= '.wp-block.alignfull .wp-block.alignfull { margin-right: 0; margin-left: 0; }';
}
}

Expand Down
4 changes: 4 additions & 0 deletions packages/block-library/src/columns/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@
padding: $block-bg-padding--v $block-bg-padding--h;
}

.wp-block-columns.alignfull.has-background {
padding-right: var(--wp--style--root--padding-right);
padding-left: var(--wp--style--root--padding-left);
}

.wp-block-column {
flex-grow: 1;
Expand Down
7 changes: 7 additions & 0 deletions packages/block-library/src/cover/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@
// This block has customizable padding, border-box makes that more predictable.
box-sizing: border-box;

&.alignfull {
margin-right: var(--wp--style--root--padding-right, 1em);
margin-left: var(--wp--style--root--padding-left, 1em);
padding-right: var(--wp--style--root--padding-right, 1em);
padding-left: var(--wp--style--root--padding-left, 1em);
}

&.has-parallax {
background-attachment: fixed;

Expand Down
7 changes: 7 additions & 0 deletions packages/block-library/src/group/theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,10 @@
// Matches paragraph block padding.
padding: $block-bg-padding--v $block-bg-padding--h;
}

.wp-block-group.alignfull {
margin-right: var(--wp--style--root--padding-right);
margin-left: var(--wp--style--root--padding-left);
padding-right: var(--wp--style--root--padding-right);
padding-left: var(--wp--style--root--padding-left);
}

0 comments on commit 6bdf2fa

Please sign in to comment.