Skip to content

Commit

Permalink
KAD-3955 nav font size now applied to link wrap
Browse files Browse the repository at this point in the history
  • Loading branch information
gilbert-hernandez committed Jan 14, 2025
1 parent decccba commit 388fd65
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
36 changes: 18 additions & 18 deletions includes/blocks/class-kadence-blocks-navigation-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function build_css( $attributes, $css, $unique_id, $unique_style_id ) {
$this->sized_dynamic_styles( $css, $nav_attributes, $unique_id, $size );
}
$css->set_media_state( 'desktop' );

// No added specificty needed for these variables.
$css->set_selector( '.wp-block-kadence-navigation' . $unique_id );
$css->render_measure_output( $nav_attributes, 'marginLink', '--kb-nav-top-link-margin', ['unit_key' => 'marginLinkUnit']);
Expand Down Expand Up @@ -115,13 +115,13 @@ public function build_css( $attributes, $css, $unique_id, $unique_style_id ) {
$css->render_measure_output( $nav_attributes, 'padding', '--kb-nav-padding', ['unit_key' => 'paddingUnit']);

//nav item (top level only)
$css->set_selector( '.wp-block-kadence-navigation' . $unique_id . ' > .navigation > .menu-container > .menu > .wp-block-kadence-navigation-link > .kb-link-wrap > .kb-nav-link-content' );
$css->set_selector( '.wp-block-kadence-navigation' . $unique_id . ' > .navigation > .menu-container > .menu > .wp-block-kadence-navigation-link > .kb-link-wrap' );
$css->render_typography( $nav_attributes );

//dropdown links (only this nav's dropdowns, exclude embedded navigations in mega menus, etc)
$css->set_selector( '.wp-block-kadence-navigation' . $unique_id . ' .sub-menu > .wp-block-kadence-navigation-link > .kb-link-wrap > .kb-nav-link-content' );
$css->render_typography( $nav_attributes, 'dropdownTypography' );

//nav item (top level only) descriptions
$css->set_selector( '.wp-block-kadence-navigation' . $unique_id . ' .menu-container > .menu > .wp-block-kadence-navigation-link > .kb-link-wrap .kb-nav-label-description' );
$css->render_typography( $nav_attributes, 'descriptionTypography' );
Expand Down Expand Up @@ -150,7 +150,7 @@ public function sized_dynamic_styles( $css, $attributes, $unique_id, $size = 'De
$css->set_selector( '.wp-block-kadence-navigation' . $unique_id );
$css->add_property( '--kb-nav-top-link-color-active-ancestor', $css->render_color( $sized_attributes['linkColorActive']), $sized_attributes['parentActive'] );
$css->add_property( '--kb-nav-top-link-background-active-ancestor', $css->render_color( $sized_attributes['backgroundActive']), $sized_attributes['parentActive'] );
$css->add_property( '--kb-nav-dropdown-link-color', $css->render_color( $sized_attributes['linkColorDropdown'] ));
$css->add_property( '--kb-nav-dropdown-link-color', $css->render_color( $sized_attributes['linkColorDropdown'] ));
$css->add_property( '--kb-nav-dropdown-link-color-hover', $css->render_color( $sized_attributes['linkColorDropdownHover'] ) );
$css->add_property( '--kb-nav-dropdown-link-color-active', $css->render_color( $sized_attributes['linkColorDropdownActive']) );
$css->add_property( '--kb-nav-dropdown-link-color-active-ancestor', $css->render_color( $sized_attributes['linkColorDropdownActive']), $sized_attributes['parentActive'] );
Expand All @@ -163,31 +163,31 @@ public function sized_dynamic_styles( $css, $attributes, $unique_id, $size = 'De
$css->add_property( '--kb-nav-dropdown-border-right', $css->render_border( $sized_attributes['dropdownBorder'], 'right' ) );
$css->add_property( '--kb-nav-dropdown-link-padding-top', $css->render_size( $sized_attributes['dropdownVerticalSpacing'], $attributes['dropdownVerticalSpacingUnit'] ), $sized_attributes['dropdownVerticalSpacing'] );
$css->add_property( '--kb-nav-dropdown-link-padding-bottom', $css->render_size( $sized_attributes['dropdownVerticalSpacing'], $attributes['dropdownVerticalSpacingUnit'] ), $sized_attributes['dropdownVerticalSpacing'] );
$css->render_measure_range(
$sized_attributes,
( 'Desktop' === $size ? 'dropdownBorderRadius' : 'dropdownBorderRadius' . $size ),
'--kb-nav-dropdown-border-radius',
'',
$css->render_measure_range(
$sized_attributes,
( 'Desktop' === $size ? 'dropdownBorderRadius' : 'dropdownBorderRadius' . $size ),
'--kb-nav-dropdown-border-radius',
'',
[
'unit_key' => 'dropdownBorderRadiusUnit',
'unit_key' => 'dropdownBorderRadiusUnit',
'first_prop' => '--kb-nav-dropdown-border-top-left-radius',
'second_prop' => '--kb-nav-dropdown-border-top-right-radius',
'third_prop' => '--kb-nav-dropdown-border-bottom-right-radius',
'fourth_prop' => '--kb-nav-dropdown-border-bottom-left-radius'
'fourth_prop' => '--kb-nav-dropdown-border-bottom-left-radius'
]
);
$css->render_measure_range( $sized_attributes, ( 'Desktop' === $size ? 'dropdownBorderRadius' : 'dropdownBorderRadius' . $size ), '--kb-nav-dropdown-border-radius', '', ['unit_key' => 'dropdownBorderRadiusUnit']);
$css->add_property( '--kb-nav-top-link-description-color', $css->render_color( $sized_attributes['descriptionColor'] ));
$css->add_property( '--kb-nav-top-link-description-color', $css->render_color( $sized_attributes['descriptionColor'] ));
$css->add_property( '--kb-nav-top-link-description-color-hover', $css->render_color( $sized_attributes['descriptionColorHover'] ) );
$css->add_property( '--kb-nav-top-link-description-color-active', $css->render_color( $sized_attributes['descriptionColorActive']) );
$css->add_property( '--kb-nav-top-link-description-color-active-ancestor', $css->render_color( $sized_attributes['descriptionColorActive']), $sized_attributes['parentActive'] );
$css->add_property( '--kb-nav-top-link-description-padding-top', $css->render_size( $sized_attributes['descriptionSpacing'], $sized_attributes['descriptionSpacingUnit'] ?? 'px' ) );
$css->add_property( '--kb-nav-dropdown-link-description-color', $css->render_color( $sized_attributes['dropdownDescriptionColor'] ));
$css->add_property( '--kb-nav-dropdown-link-description-color', $css->render_color( $sized_attributes['dropdownDescriptionColor'] ));
$css->add_property( '--kb-nav-dropdown-link-description-color-hover', $css->render_color( $sized_attributes['dropdownDescriptionColorHover'] ) );
$css->add_property( '--kb-nav-dropdown-link-description-color-active', $css->render_color( $sized_attributes['dropdownDescriptionColorActive']) );
$css->add_property( '--kb-nav-dropdown-link-description-color-active-ancestor', $css->render_color( $sized_attributes['dropdownDescriptionColorActive']), $sized_attributes['parentActive'] );
$css->add_property( '--kb-nav-dropdown-link-description-padding-top', $css->render_size( $sized_attributes['dropdownDescriptionSpacing'], $sized_attributes['dropdownDescriptionSpacingUnit'] ?? 'px' ) );

//additional dynamic logic, but still lands in a slot in the static stylesheet
if ( isset( $navigation_vertical_spacing ) && is_numeric( $navigation_vertical_spacing ) ) {
$css->add_property( '--kb-nav-row-gap', $css->render_size( $navigation_vertical_spacing, $attributes['spacingUnit'] ) );
Expand Down Expand Up @@ -291,7 +291,7 @@ public function sized_dynamic_styles( $css, $attributes, $unique_id, $size = 'De

//not last submenu items and mega menu nav links
$css->set_selector( '.wp-block-kadence-navigation' . $unique_id . ' .sub-menu > .menu-item:not(:last-of-type), .wp-block-kadence-navigation' . $unique_id . ' .sub-menu.mega-menu > .menu-item > .kb-link-wrap > .kb-nav-link-content' );
$css->add_property( '--kb-nav-menu-item-border-bottom', $css->render_border( $sized_attributes['dropdownDivider'], 'bottom' ) );
$css->add_property( '--kb-nav-menu-item-border-bottom', $css->render_border( $sized_attributes['dropdownDivider'], 'bottom' ) );
}

/**
Expand Down Expand Up @@ -416,7 +416,7 @@ public function build_html( $attributes, $unique_id, $content, $block_instance )

if ( $nav_attributes['enableScrollSpy'] ) {
$wrapper_attribute_items['data-scroll-spy-offset'] = isset( $nav_attributes['scrollSpyOffsetManual'] ) && $nav_attributes['scrollSpyOffsetManual'] ? $nav_attributes['scrollSpyOffset'] : false;
$wrapper_attribute_items['data-scroll-spy-id'] = uniqid();
$wrapper_attribute_items['data-scroll-spy-id'] = uniqid();
}

$wrapper_attributes = get_block_wrapper_attributes( $wrapper_attribute_items );
Expand Down Expand Up @@ -480,7 +480,7 @@ public function build_html( $attributes, $unique_id, $content, $block_instance )
/**
* Generates content to replace actual blocks for templated navigation placeholders.
* This should match the templated blocks created in the editor for the same template keys
*
*
* @param array $attributes The database attribtues.
*/
public function applyTemplateKeyBlocks( $attributes ) {
Expand Down Expand Up @@ -519,7 +519,7 @@ public function applyTemplateKeyBlocks( $attributes ) {
<!-- /wp:kadence/navigation -->
';
break;

default:
return '
<!-- wp:kadence/navigation -->
Expand Down
2 changes: 1 addition & 1 deletion src/blocks/navigation/components/backend-styles/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ export default function BackendStyles(props) {

//nav item (top level only)
css.set_selector(
`.wp-block-kadence-navigation${uniqueID} .menu-container > .menu > .wp-block-kadence-navigation-link > .kb-link-wrap > .kb-nav-link-content`
`.wp-block-kadence-navigation${uniqueID} .menu-container > .menu > .wp-block-kadence-navigation-link > .kb-link-wrap`
);
css.render_font(typography ? typography : [], previewDevice);

Expand Down

0 comments on commit 388fd65

Please sign in to comment.