Skip to content

Commit

Permalink
Optimizations to className() and events()
Browse files Browse the repository at this point in the history
  • Loading branch information
swashbuck committed Apr 9, 2024
1 parent 732e195 commit 426b8c1
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions js/BoxMenuItemView.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,23 @@ import router from 'core/js/router';
class BoxMenuItemView extends MenuItemView {

className() {
const entireItemClickable = this.areEntireItemsClickable() ? 'is-entire-item-clickable' : '';
return `${super.className()} boxmenu-item ${entireItemClickable}`;
let classes = `${super.className()} boxmenu-item`;
if (this.areEntireItemsClickable()) {
classes += ' is-entire-item-clickable';
}
return classes;
}

events() {
if (this.areEntireItemsClickable()) {
return {
click: 'onClickMenuItemButton'
};
} else {
return {
'click .js-btn-click': 'onClickMenuItemButton'
};
}

return {
'click .js-btn-click': 'onClickMenuItemButton'
};
}

attributes() {
Expand Down

0 comments on commit 426b8c1

Please sign in to comment.