Skip to content

Commit

Permalink
more setting sfor nav link padding/margin in submenus
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-c-woodard committed Jul 30, 2024
1 parent 6b4e112 commit 92255aa
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,11 @@ public function build_css( $attributes, $css, $unique_id, $unique_style_id ) {
$css->add_property( 'box-shadow', $css->render_shadow( $nav_link_attributes['dropdownShadow'][0] ) );
}

// Dropdown link
$css->set_selector( '.wp-block-kadence-navigation .navigation .menu-container ul .wp-block-kadence-navigation-link' . $unique_id . ' ul li.menu-item > .link-drop-wrap > a' );
$css->render_measure_output( $nav_link_attributes, 'marginDropdownLink', 'margin', ['unit_key' => 'marginDropdownLinkUnit']);
$css->render_measure_output( $nav_link_attributes, 'paddingDropdownLink', 'padding', ['unit_key' => 'paddingDropdownLinkUnit']);

//description styles
$css->set_selector( '.wp-block-kadence-navigation-link' . $unique_id . ' .menu-label-description:not(.wp-block-kadence-navigation-link' . $unique_id . ' .wp-block-kadence-navigation-link .menu-label-description)' );
$css->render_typography( $nav_link_attributes, 'descriptionTypography' );
Expand Down
1 change: 0 additions & 1 deletion src/blocks/header/components/visual-builder/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ export default function VisualBuilder({ clientId, previewDevice, isSelected }) {
}, [isVisible, previewDevice]);

const setIsVisible = () => {
console.log(1, previewDevice);
setHeaderVisualBuilderOpenId(isVisible ? null : clientId);
};

Expand Down
32 changes: 32 additions & 0 deletions src/blocks/navigation-link/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,38 @@
"type": "string",
"default": "px"
},
"paddingDropdownLink": {
"type": "array",
"default": ["", "", "", ""]
},
"tabletPaddingDropdownLink": {
"type": "array",
"default": ["", "", "", ""]
},
"mobilePaddingDropdownLink": {
"type": "array",
"default": ["", "", "", ""]
},
"paddingDropdownLinkUnit": {
"type": "string",
"default": "px"
},
"marginDropdownLink": {
"type": "array",
"default": ["", "", "", ""]
},
"tabletMarginDropdownLink": {
"type": "array",
"default": ["", "", "", ""]
},
"mobileMarginDropdownLink": {
"type": "array",
"default": ["", "", "", ""]
},
"marginDropdownLinkUnit": {
"type": "string",
"default": "px"
},
"linkColorDropdown": {
"type": "string",
"default": ""
Expand Down
24 changes: 24 additions & 0 deletions src/blocks/navigation-link/components/backend-styles/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ export default function BackendStyles(props) {
tabletMarginDropdown,
mobileMarginDropdown,
marginDropdownUnit,
paddingDropdownLink,
tabletPaddingDropdownLink,
mobilePaddingDropdownLink,
paddingDropdownLinkUnit,
marginDropdownLink,
tabletMarginDropdownLink,
mobileMarginDropdownLink,
marginDropdownLinkUnit,
linkColor,
linkColorHover,
linkColorActive,
Expand Down Expand Up @@ -758,6 +766,22 @@ export default function BackendStyles(props) {
css.set_selector(
`.wp-block-kadence-navigation .navigation .menu-container ul .wp-block-kadence-navigation-link${uniqueID} ul li.menu-item > .link-drop-wrap > a`
);
css.render_measure_output(
paddingDropdownLink,
tabletPaddingDropdownLink,
mobilePaddingDropdownLink,
previewDevice,
'padding',
paddingDropdownLinkUnit
);
css.render_measure_output(
marginDropdownLink,
tabletMarginDropdownLink,
mobileMarginDropdownLink,
previewDevice,
'margin',
marginDropdownLinkUnit
);
css.add_property('padding-top', css.render_size(previewDropdownVerticalSpacing, dropdownVerticalSpacingUnit));
css.add_property('padding-bottom', css.render_size(previewDropdownVerticalSpacing, dropdownVerticalSpacingUnit));
css.render_font(dropdownTypography ? dropdownTypography : [], previewDevice);
Expand Down
2 changes: 1 addition & 1 deletion src/blocks/navigation/edit-inner.js
Original file line number Diff line number Diff line change
Expand Up @@ -1401,7 +1401,7 @@ export function EditInner(props) {
}}
min={0}
max={
paddingDropdownUnit === 'em' || paddingDropdownLinkUnit === 'rem'
paddingDropdownLinkUnit === 'em' || paddingDropdownLinkUnit === 'rem'
? 24
: paddingDropdownLinkUnit === 'px'
? 200
Expand Down

0 comments on commit 92255aa

Please sign in to comment.