Skip to content

Commit

Permalink
add default
Browse files Browse the repository at this point in the history
  • Loading branch information
kadencewp committed Sep 3, 2024
1 parent 199a3b6 commit cda1e62
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
12 changes: 9 additions & 3 deletions includes/blocks/class-kadence-blocks-navigation-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,13 @@ public function build_css( $attributes, $css, $unique_id, $unique_style_id ) {
}
$css->set_media_state( 'desktop' );

//no added specificty needed for these variables
// No added specificty needed for these variables.
$css->set_selector( '.wp-block-kadence-navigation' . $unique_id );
$css->render_measure_output( $nav_attributes, 'marginDropdown', '--kb-nav-dropdown-margin', ['unit_key' => 'marginDropdownUnit']);
$css->render_measure_output( $nav_attributes, 'paddingDropdown', '--kb-nav-dropdown-padding', ['unit_key' => 'paddingDropdownUnit']);
$css->render_measure_output( $nav_attributes, 'marginDropdown', '--kb-nav-dropdown-margin', [ 'unit_key' => 'marginDropdownUnit' ] );
$css->render_measure_output( $nav_attributes, 'paddingDropdown', '--kb-nav-dropdown-padding', [ 'unit_key' => 'paddingDropdownUnit' ] );
if ( isset( $nav_attributes['dropdownShadow'][0]['enable'] ) && $nav_attributes['dropdownShadow'][0]['enable'] ) {
$css->add_property( '--kb-nav-dropdown-box-shadow', $css->render_shadow( $nav_attributes['dropdownShadow'][0] ) );
}

//main container (don't apply to children)
$css->set_selector( '.wp-block-kadence-navigation' . $unique_id . ' > .navigation > .menu-container > .menu');
Expand Down Expand Up @@ -178,12 +181,15 @@ public function sized_dynamic_styles( $css, $attributes, $unique_id, $size = 'De
}

if ( $sized_attributes['orientation'] != 'vertical' ) {
<<<<<<< Updated upstream
$css->add_property( '--kb-nav-dropdown-link-width', $css->render_size( $sized_attributes['dropdownWidth'], $sized_attributes['dropdownWidthUnit'] ) );
$css->add_property( '--kb-nav-top-not-last-link-border-right', $css->render_border( $sized_attributes['divider'], 'bottom' ) );

if ( $sized_attributes['dropdownShadow'] && isset( $sized_attributes['dropdownShadow'][0] ) && $sized_attributes['dropdownShadow'][0]['enable'] ) {
$css->add_property( '--kb-nav-dropdown-box-shadow', $css->render_shadow( $sized_attributes['dropdownShadow'][0] ) );
}
=======
>>>>>>> Stashed changes

if ( $sized_attributes['dropdownHorizontalAlignment'] == 'center' ) {
$css->add_property( '--kb-nav-dropdown-show-left', '50%' );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,7 @@ public function build_css( $attributes, $css, $unique_id, $unique_style_id ) {
'mobile_key' => 'dropdownBorderRadiusMobile',
) );
$css->render_border_styles( $nav_link_attributes, 'dropdownBorder' );

if ( $nav_link_attributes['dropdownShadow'] && isset( $nav_link_attributes['dropdownShadow'][0] ) && $nav_link_attributes['dropdownShadow'][0]['enable'] ) {
if ( isset( $nav_link_attributes['dropdownShadow'][0]['enable'] ) && $nav_link_attributes['dropdownShadow'][0]['enable'] ) {
$css->add_property( 'box-shadow', $css->render_shadow( $nav_link_attributes['dropdownShadow'][0] ) );
}

Expand Down Expand Up @@ -343,6 +342,7 @@ public function sized_dynamic_styles( $css, $attributes, $unique_id, $size = 'De
$css->add_property( '--kb-nav-dropdown-link-color', $css->render_color( $sized_attributes['linkColorDropdown'] ), $sized_attributes['linkColorDropdown'] );
$css->add_property( '--kb-nav-dropdown-link-color-hover', $css->render_color( $sized_attributes['linkColorDropdownHover'] ), $sized_attributes['linkColorDropdownHover'] );
$css->add_property( '--kb-nav-dropdown-link-color-active', $css->render_color( $sized_attributes['linkColorDropdownActive']), $sized_attributes['linkColorDropdownActive'] );
<<<<<<< Updated upstream
$css->add_property( '--kb-nav-dropdown-link-color-active-ancestor', $css->render_color( $sized_attributes['linkColorDropdownActive']), $sized_attributes['parentActive'] && $sized_attributes['linkColorDropdownActive'] );
$css->add_property( '--kb-nav-dropdown-background', $css->render_color( $sized_attributes['backgroundDropdown'] ) );
$css->add_property( '--kb-nav-dropdown-link-background-hover', $css->render_color( $sized_attributes['backgroundDropdownHover'] ));
Expand All @@ -351,13 +351,16 @@ public function sized_dynamic_styles( $css, $attributes, $unique_id, $size = 'De
$css->add_property( '--kb-nav-dropdown-link-padding-top', $css->render_size( $sized_attributes['dropdownVerticalSpacing'], $attributes['dropdownVerticalSpacingUnit'] ) );
$css->add_property( '--kb-nav-dropdown-link-padding-bottom', $css->render_size( $sized_attributes['dropdownVerticalSpacing'], $attributes['dropdownVerticalSpacingUnit'] ) );

=======
$css->add_property( '--kb-nav-dropdown-link-color-active-ancestor', $css->render_color( $sized_attributes['linkColorDropdownActive'] ), $sized_attributes['linkColorDropdownActive'] );
>>>>>>> Stashed changes

//no bleed variables (extra specific to beat things like dropdown or top level styling)
$css->set_selector( '.kb-nav-link-' . $unique_id . ' > .kb-link-wrap.kb-link-wrap.kb-link-wrap.kb-link-wrap' );
$css->add_property( '--kb-nav-link-color', $css->render_color( $sized_attributes['linkColor'] ), $sized_attributes['linkColor'] );
$css->add_property( '--kb-nav-link-color-hover', $css->render_color( $sized_attributes['linkColorHover'] ), $sized_attributes['linkColorHover'] );
$css->add_property( '--kb-nav-link-color-active', $css->render_color( $sized_attributes['linkColorActive']), $sized_attributes['linkColorActive'] );
$css->add_property( '--kb-nav-link-color-active-ancestor', $css->render_color( $sized_attributes['linkColorActive']), $sized_attributes['parentActive'] && $sized_attributes['linkColorActive'] );
$css->add_property( '--kb-nav-link-color-active-ancestor', $css->render_color( $sized_attributes['linkColorActive']), $sized_attributes['linkColorActive'] );



Expand Down
2 changes: 1 addition & 1 deletion src/blocks/navigation/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@
--kb-nav-link-padding-bottom: var(--kb-nav-dropdown-link-padding-bottom);

& > .kb-nav-link-content {
width: var(--kb-nav-dropdown-link-width);
width: var(--kb-nav-dropdown-link-width, 200px);
}
}
}
Expand Down

0 comments on commit cda1e62

Please sign in to comment.