Skip to content

Commit

Permalink
Switch to inherit to set value for nested containers, and also set a …
Browse files Browse the repository at this point in the history
…default value for themes that may not have -wp--style--block-gap set
  • Loading branch information
Glen Davies committed Jan 11, 2022
1 parent b8b8f29 commit e4dc4aa
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/block-library/src/navigation/edit/inner-blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export default function NavigationInnerBlocks( {
{
className: 'wp-block-navigation__container',
style: {
gap: blockGap ? blockGap : 'var( --wp--style--block-gap )',
gap: blockGap ? blockGap : 'var( --wp--style--block-gap, 2em )',
},
},
{
Expand Down
4 changes: 3 additions & 1 deletion packages/block-library/src/navigation/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,9 @@ function render_block_core_navigation( $attributes, $content, $block ) {

$block_gap = '';
if ( wp_get_global_settings( array( 'spacing', 'blockGap' ) ) ) {
$block_gap = isset( $attributes['style']['spacing']['blockGap'] ) ? 'style="gap: ' . $attributes['style']['spacing']['blockGap'] . '"' : 'style="gap: var( --wp--style--block-gap )"';
$block_gap = isset( $attributes['style']['spacing']['blockGap'] ) ? 'style="gap: ' . $attributes['style']['spacing']['blockGap'] . '"' : 'style="gap: var( --wp--style--block-gap, 2em )"';
} else {
$block_gap = 'style="gap: var( --wp--style--block-gap, 2em )"';
}

$colors = block_core_navigation_build_css_colors( $attributes );
Expand Down
6 changes: 3 additions & 3 deletions packages/block-library/src/navigation/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ button.wp-block-navigation-item__content {
.wp-block-navigation .wp-block-page-list,
.wp-block-navigation__container,
.wp-block-navigation__responsive-container-content {
gap: var(--wp--style--block-gap, 2em);
gap: inherit;
}

// Menu items with background.
Expand All @@ -320,7 +320,7 @@ button.wp-block-navigation-item__content {
&,
.wp-block-navigation .wp-block-page-list,
.wp-block-navigation__container {
gap: var(--wp--style--block-gap, 0.5em);
gap: inherit;
}
}

Expand Down Expand Up @@ -508,7 +508,7 @@ button.wp-block-navigation-item__content {
// Space unfolded items using gap and padding for submenus.
.wp-block-navigation__submenu-container,
.wp-block-navigation__container {
gap: var(--wp--style--block-gap, 2em);
gap: inherit;
}

// Apply top padding to nested submenus.
Expand Down

0 comments on commit e4dc4aa

Please sign in to comment.