Skip to content

Commit

Permalink
docs: change the icon of the button showing/hiding the second level o…
Browse files Browse the repository at this point in the history
…f Side Nav (#2055)

* fix: change the icon of the button showing/hiding the second level of Side Nav

* update tests
  • Loading branch information
InnaAtanasova committed Jan 14, 2021
1 parent 9d0c20b commit bb48e35
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
11 changes: 11 additions & 0 deletions .storybook/static/preview-head.js
Original file line number Diff line number Diff line change
Expand Up @@ -345,3 +345,14 @@ function isSpaceOrEnter(event, buttonFn) {
break;
}
}

function toggleNestedListSubmenu(event) {
let button = event.target;
let icon = button.children[0];

if(button && button.classList.contains('is-expanded')) {
icon.classList = 'sap-icon--navigation-right-arrow';
} else {
icon.classList = 'sap-icon--navigation-down-arrow';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ exports[`Storyshots Components/Side Navigation Complex (compact) 1`] = `
aria-haspopup="true"
aria-label="Expand submenu"
class="fd-button fd-nested-list__button"
onclick="toggleNestedListSubmenu(event)"
>


Expand Down Expand Up @@ -558,6 +559,7 @@ exports[`Storyshots Components/Side Navigation Complex 1`] = `
aria-haspopup="true"
aria-label="Expand submenu"
class="fd-button fd-nested-list__button"
onclick="toggleNestedListSubmenu(event)"
>


Expand Down Expand Up @@ -1686,6 +1688,7 @@ exports[`Storyshots Components/Side Navigation Group 1`] = `
aria-haspopup="true"
aria-label="Expand submenu"
class="fd-button fd-nested-list__button"
onclick="toggleNestedListSubmenu(event)"
>


Expand Down
10 changes: 7 additions & 3 deletions stories/side-navigation/side-navigation.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,9 @@ export const cozyGrouping = () => `<div class="fd-side-nav">
aria-controls="EX100L2"
aria-haspopup="true"
aria-expanded="false"
aria-label="Expand submenu">
aria-label="Expand submenu"
onclick="toggleNestedListSubmenu(event)"
>
<i class="sap-icon--navigation-right-arrow" role="presentation"></i>
</button>
</div>
Expand Down Expand Up @@ -263,7 +265,8 @@ export const complexCozySideNav = () => `<div class="fd-side-nav">
aria-controls="EX400L2"
aria-haspopup="true"
aria-expanded="false"
aria-label="Expand submenu">
aria-label="Expand submenu"
onclick="toggleNestedListSubmenu(event)">
<i class="sap-icon--navigation-right-arrow" role="presentation"></i>
</button>
</div>
Expand Down Expand Up @@ -368,7 +371,8 @@ export const complexCompactSideNav = () => `<div class="fd-side-nav">
aria-controls="EX500L2"
aria-haspopup="true"
aria-expanded="false"
aria-label="Expand submenu">
aria-label="Expand submenu"
onclick="toggleNestedListSubmenu(event)">
<i class="sap-icon--navigation-right-arrow" role="presentation"></i>
</button>
</div>
Expand Down

0 comments on commit bb48e35

Please sign in to comment.