Skip to content

Commit

Permalink
KAD-3175 Extend template when no content exists in a section
Browse files Browse the repository at this point in the history
  • Loading branch information
oakesjosh committed Aug 15, 2024
1 parent a2ffd42 commit 0970307
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ public function build_html( $attributes, $unique_id, $content, $block_instance )
}
}

if( empty( $content ) ) {
$classes[] = 'no-content';
}

$html .= '<div class="' . esc_attr( implode( ' ', $classes ) ) . '">';
$html .= $content;
$html .= '</div>';
Expand Down
1 change: 1 addition & 0 deletions src/blocks/header/children/column/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export function Edit(props) {
'wp-block-kadence-header-column': true,
[`wp-block-kadence-header-column-${location}`]: location,
[`wp-block-kadence-header-column${uniqueID}`]: uniqueID,
'no-content': !hasChildBlocks,
});
const innerBlocksProps = useInnerBlocksProps(
{
Expand Down
3 changes: 3 additions & 0 deletions src/blocks/header/children/row/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
grid-template-columns: 1fr auto 1fr;
margin: 0 auto;
}
.kadence-header-row-inner:has(div.no-content) {
grid-template-columns: auto auto auto;
}
.wp-block-kadence-header-column,
.wp-block-kadence-header-section {
gap: 10px;
Expand Down
4 changes: 4 additions & 0 deletions src/blocks/header/children/row/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
grid-template-columns: 1fr auto 1fr;
margin: 0 auto;
}
.kadence-header-row-inner:has(div.no-content) {
grid-template-columns: auto auto auto;
}

.wp-block-kadence-header-column,
.wp-block-kadence-header-section {
gap: 10px;
Expand Down

0 comments on commit 0970307

Please sign in to comment.