Skip to content

Commit

Permalink
fixed mobile functionality on initial load bug
Browse files Browse the repository at this point in the history
  • Loading branch information
tishoyanchev committed May 29, 2024
1 parent 79110e8 commit d052a1b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ function App() {
console.log('ifxSelect event emitted with value:', e.detail);
}


return (
<div>
<IfxMultiselect options={options} batchSize={20}
Expand Down
20 changes: 10 additions & 10 deletions packages/components/src/components/navbar/navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export class Navbar {
}
}

getNavComponents() {
getWrappers() {
const searchBarRightWrapper = this.el.shadowRoot.querySelector('.navbar__container-right-content-navigation-item-search-bar-icon-wrapper')
const searchBarLeftWrapper = this.el.shadowRoot.querySelector('.navbar__container-left-content-navigation-item-search-bar')
const rightSideSlot = searchBarRightWrapper.querySelector('slot');
Expand All @@ -125,8 +125,8 @@ export class Navbar {
return {rightSideSlot, leftSideSlot, rightAssignedNodes, leftAssignedNodes, navbarProfile, leftMenuItems, rightMenuItems, topRowWrapper};
}

hideNavComponents() {
const { rightAssignedNodes, leftAssignedNodes, navbarProfile, leftMenuItems, rightMenuItems, topRowWrapper } = this.getNavComponents();
hideNavItems() {
const { rightAssignedNodes, leftAssignedNodes, navbarProfile, leftMenuItems, rightMenuItems, topRowWrapper } = this.getWrappers();

if(rightAssignedNodes.length !== 0) {
this.searchBarIsOpen = 'right'
Expand All @@ -152,8 +152,8 @@ export class Navbar {
}
}

showNavComponents() {
const { navbarProfile, leftMenuItems, rightMenuItems, topRowWrapper } = this.getNavComponents();
showNavItems() {
const { navbarProfile, leftMenuItems, rightMenuItems, topRowWrapper } = this.getWrappers();
this.searchBarIsOpen = undefined;

navbarProfile.showComponent()
Expand All @@ -180,9 +180,9 @@ export class Navbar {
handleSearchBarToggle(event: CustomEvent) {

if(event.detail) {
this.hideNavComponents();
this.hideNavItems();
} else if(!event.detail) {
this.showNavComponents();
this.showNavItems();
}
}

Expand Down Expand Up @@ -318,7 +318,6 @@ export class Navbar {
}
this.handleLogoHrefAndTarget();


const mediaQueryList = window.matchMedia('(max-width: 800px)');
mediaQueryList.addEventListener('change', (e) => this.moveNavItemsToSidebar(e));
}
Expand All @@ -329,7 +328,7 @@ export class Navbar {
return searchBarLeftWrapper;
}

moveNavItemsToSidebar(e) {
moveNavItemsToSidebar(e?: MediaQueryListEvent) {
const topRowWrapper = this.el.shadowRoot.querySelector('.navbar__sidebar-top-row-wrapper')
const mediaQueryList = this.getMediaQueryList();
const matches = e ? e.matches : mediaQueryList.matches;
Expand Down Expand Up @@ -438,8 +437,9 @@ export class Navbar {
}
}
}




render() {
return (
<div aria-label='a navigation navbar' class={`navbar__wrapper ${this.fixed ? 'fixed' : ""}`}>
Expand Down

0 comments on commit d052a1b

Please sign in to comment.