Skip to content

Commit

Permalink
fix(app-navigation-main-mobile): second level if no children (#1612)
Browse files Browse the repository at this point in the history
  • Loading branch information
Arturo Castillo Delgado authored Feb 23, 2023
1 parent 71dca47 commit 88e0cd2
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ import {
import { MenuItem } from '../app-interfaces';
import { findSelected, findRootNode } from '../../../utils/menu-utils';

const hasChildren = (item: any) =>
Array.isArray(item.children) && item.children.length > 0;

@Component({
tag: 'app-navigation-main-mobile',
styleUrl: 'app-navigation-main-mobile.css',
Expand Down Expand Up @@ -77,7 +80,7 @@ export class MainNavigationMobile {
item.onClick(event);
}

if (!selected.children) {
if (!hasChildren(selected)) {
this.closeMenuHandler();
}
}
Expand Down Expand Up @@ -202,7 +205,7 @@ export class MainNavigationMobile {
>
<a
aria-current={isActive(item.id) ? 'true' : 'false'}
aria-haspopup={item.children ? 'true' : 'false'}
aria-haspopup={hasChildren(item) ? 'true' : 'false'}
class={`main-navigation-mobile__item-link${
isActive(item.id)
? ' main-navigation-mobile__item-link--selected'
Expand Down Expand Up @@ -234,7 +237,7 @@ export class MainNavigationMobile {
<div class="main-navigation-mobile__item-wrapper">
<span>{item.name}</span>
{isActive(item.id) && <span class="sr-only">active</span>}
{item.children && (
{hasChildren(item) && (
<scale-icon-navigation-right></scale-icon-navigation-right>
)}
</div>
Expand Down

0 comments on commit 88e0cd2

Please sign in to comment.