Skip to content

Commit

Permalink
code refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
rajatkhurana-adobe committed Oct 16, 2024
1 parent 000417d commit a363dac
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ This approach is implemented to optimize performance by avoiding additional netw
```
BLOCK cmp-adaptiveform-container
ELEMENT cmp-adaptiveform-container__wrapper
ELEMENT cmp-adaptiveform-container__hamburger-menu
ELEMENT cmp-adaptiveform-container__hamburger-menu-top
ELEMENT cmp-adaptiveform-container__hamburger-menu-icon-container
ELEMENT cmp-adaptiveform-container__hamburger-menu-icon
ELEMENT cmp-adaptiveform-container__hamburger-menu-middle
ELEMENT cmp-adaptiveform-container__hamburger-menu-bottom
ELEMENT cmp-adaptiveform-container__hamburger-menu-active-item-title
MODIFIER cmp-adaptiveform-container__hamburger-menu-button--prev
MODIFIER cmp-adaptiveform-container__hamburger-menu-button--next
```

In edit mode, the BEM structure includes a modifier for the cmp-adaptiveform-container block,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,6 @@ if (typeof window.HamburgerMenu === 'undefined') {
}
}

#isRepeatable(item) {
return item.fieldType === 'panel' && item.type === 'array'
}

#updateSelectedPanelTitle(anchorElement, clickedAnchorElement) {
const activeItemTitleContent = anchorElement?.innerText;
const clickedAnchorElementText = clickedAnchorElement?.innerText;
Expand Down Expand Up @@ -313,7 +309,7 @@ if (typeof window.HamburgerMenu === 'undefined') {
}

link.classList.add(HamburgerMenu.cssClasses.hamburgerMenuWidget.hamburgerMenuNavLink);
if (this.#isRepeatable(item)) {
if (item?.repeatable) {
const subMenu = this.#createHamburgerMenu(item.items, counter + 1);
subMenu?.childNodes.forEach(child => ul.appendChild(child));
} else if (Array.isArray(item.items) && item.items.length > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<input type="hidden" name=":formstart" value="${resource.path}"/>
<input type="hidden" name="_charset_" value="utf-8"/>
<input data-sly-test="${container.redirectUrl}" type="hidden" name=":redirect" value="${container.redirectUrl}"/>
<div data-sly-test="${container.isHamburgerMenuEnabled}" class="cmp-adaptiveform-container__hamburger-menu">
<div data-sly-test="${container.isHamburgerMenuEnabled && !wcmmode.edit}" class="cmp-adaptiveform-container__hamburger-menu">
<div class="cmp-adaptiveform-container__hamburger-menu-top">
<div role="navigation" aria-label="Toggle menu" class="cmp-adaptiveform-container__hamburger-menu-icon-container">
<button aria-controls="hamburger-menu" type="button" class="cmp-adaptiveform-container__hamburger-menu-icon" aria-label="Toggle menu"></button>
Expand Down

0 comments on commit a363dac

Please sign in to comment.