Skip to content
This repository was archived by the owner on Aug 7, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/oui-navbar/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ It defines the menu in reponsive mode. It will be visible only for screen resolu
This property is only available for root links of `aside-links`.

- `iconClass`: define `class` of the menu item icon.
- `iconAnimated`: define if the menu item icon should be animated

```json
[{
Expand All @@ -357,6 +358,7 @@ This property is only available for root links of `aside-links`.
"label": String,
"title": String,
"iconClass": String,
"iconAnimated": Boolean,
"subLinks": Array[{
"label": String,
"title": String,
Expand All @@ -379,6 +381,7 @@ This property is only available for root links of `aside-links`.
acknowledged: '!true'
}).length"
icon-class="{{asideLink.iconClass}}"
icon-animated="asideLink.name === 'notifications'"
on-click="asideLink.onClick"
ng-repeat="asideLink in $ctrl.asideLinks track by $index"
ng-class="asideLink.class"
Expand Down Expand Up @@ -548,6 +551,7 @@ The property `name` **must be** `"user"`.
| `text` | string | @ | yes | n/a | n/a | text of the button
| `aria-label` | string | @? | yes | n/a | n/a | accessibility label of the button
| `icon-class` | string | @? | yes | n/a | n/a | classname of the button icon
| `icon-animated` | boolean | <? | no | `true`, `false` | `false` | defines if the menu item icon should be shaking
| `icon-badge` | number | <? | no | n/a | n/a | number on the badge of the button icon
| `on-click` | function | & | no | n/a | n/a | click callback

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export default {
label: "@?ariaLabel",
iconBadge: "<?",
iconClass: "@?",
iconAnimated: "<?",
onClick: "&"
},
controller,
Expand Down
6 changes: 4 additions & 2 deletions packages/oui-navbar/src/dropdown/navbar-dropdown.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
ng-class="::!!$ctrl.iconClass ? 'oui-navbar-link_icon' : null"
ng-click="$ctrl.navbarCtrl.toggleMenu($ctrl.name); $ctrl.onClick();"
oui-navbar-group="{{::$ctrl.name}}">
<span class="oui-icon" aria-hidden="true"
<span class="oui-icon {{:: 'navbar-' + $ctrl.iconClass }}" aria-hidden="true"
ng-if="::!!$ctrl.iconClass"
ng-class="::'navbar-' + $ctrl.iconClass">
ng-class="{
'oui-icon_shake': $ctrl.iconAnimated
}">
<span class="oui-icon__badge"
ng-if="!!$ctrl.iconBadge"
ng-bind="$ctrl.iconBadge">
Expand Down
1 change: 1 addition & 0 deletions packages/oui-navbar/src/index.spec.data.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"class": "navbar-notification__list",
"title": "Notifications",
"iconClass": "oui-icon oui-icon-info_circle",
"iconAnimated": true,
"subLinks": [
{
"subject": "Maecenas id ipsum suscipit",
Expand Down
6 changes: 6 additions & 0 deletions packages/oui-navbar/src/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,12 @@ describe("ouiNavbar", () => {
expect(data[userIndex].name).toBe("user");
expect(userMenu.hasClass("oui-navbar-menu_user")).toBe(true);
});

it("should animate menu item icon", () => {
const notificationsIndex = 1;
const notificationsMenu = angular.element(menu.children("oui-navbar-dropdown")[notificationsIndex].querySelector(".oui-icon"));
expect(notificationsMenu.hasClass("oui-icon_shake")).toBe(true);
});
});

describe("Responsive menu", () => {
Expand Down
1 change: 1 addition & 0 deletions packages/oui-navbar/src/navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
aria-label="{{::!!asideLink.label ? asideLink.label : null}}"
icon-badge="(asideLink.subLinks | filter: {isActive: 'true', acknowledged: '!true'}).length"
icon-class="{{::!!asideLink.iconClass ? asideLink.iconClass : null}}"
icon-animated="asideLink.iconAnimated ? asideLink.iconAnimated : false"
on-click="asideLink.onClick()"
ng-repeat="asideLink in $ctrl.asideLinks track by $index"
ng-class="::!!asideLink.class ? asideLink.class : null"
Expand Down