Skip to content

Commit 6dec76c

Browse files
committed
fix lint on navbar link
1 parent 138526d commit 6dec76c

File tree

2 files changed

+29
-28
lines changed

2 files changed

+29
-28
lines changed

addon/components/es-header/navbar-link.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { computed } from '@ember/object';
44
import { equal } from '@ember/object/computed';
55
import { inject as service } from '@ember/service';
66
import { schedule, next } from '@ember/runloop';
7+
import { action } from '@ember/object';
78

89
export default Component.extend({
910
layout,
@@ -47,26 +48,25 @@ export default Component.extend({
4748
});
4849
},
4950

50-
actions: {
51-
toggleDropdown(event) {
52-
this.get('navbar').closePopupMenu(this);
53-
this.toggleProperty('isDropdownOpen');
51+
@action
52+
toggleDropdown(event) {
53+
this.get('navbar').closePopupMenu(this);
54+
this.toggleProperty('isDropdownOpen');
5455

55-
if (this.isDropdownOpen) {
56-
// if it's open, let's make sure it can do some things
57-
schedule('afterRender', this, function() {
58-
this.setupLinkBlurs();
56+
if (this.isDropdownOpen) {
57+
// if it's open, let's make sure it can do some things
58+
schedule('afterRender', this, function() {
59+
this.setupLinkBlurs();
5960

60-
// move focus to the first item in the dropdown only when opened with keyboard
61-
// ref https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/detail
62-
if (event.detail === 0) {
63-
this.processFirstElementFocus();
64-
}
61+
// move focus to the first item in the dropdown only when opened with keyboard
62+
// ref https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/detail
63+
if (event.detail === 0) {
64+
this.processFirstElementFocus();
65+
}
6566

66-
this.processKeyPress();
67-
});
68-
}
69-
},
67+
this.processKeyPress();
68+
});
69+
}
7070
},
7171

7272
closeDropdown() {
Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
1-
{{#if (eq link.type "link")}}
1+
{{#if (eq @link.type "link")}}
22
<a
33
class="navbar-list-item-link"
4-
href={{link.href}}
4+
href={{@link.href}}
55
>
6-
{{link.name}}
6+
{{@link.name}}
77
</a>
88
{{/if}}
9-
{{#if (eq link.type "dropdown")}}
9+
{{#if (eq @link.type "dropdown")}}
1010
<button
11-
onclick={{action "toggleDropdown"}}
12-
class="navbar-list-item-dropdown-toggle {{if isDropdownOpen "active"}}"
13-
aria-expanded={{isExpanded}}
11+
type="button"
12+
class="navbar-list-item-dropdown-toggle {{if this.isDropdownOpen "active"}}"
13+
aria-expanded={{this.isExpanded}}
14+
{{on "click" this.toggleDropdown}}
1415
>
15-
{{link.name}}
16+
{{@link.name}}
1617
</button>
17-
{{#if isDropdownOpen}}
18+
{{#if this.isDropdownOpen}}
1819
<ul class="navbar-dropdown-list">
19-
{{#each link.items as |item|}}
20+
{{#each @link.items as |item|}}
2021
{{#if (eq item.type "link")}}
2122
<li class="navbar-dropdown-list-item">
2223
<a
@@ -33,4 +34,4 @@
3334
{{/each}}
3435
</ul>
3536
{{/if}}
36-
{{/if}}
37+
{{/if}}

0 commit comments

Comments
 (0)