Skip to content

Commit

Permalink
Merge pull request #1564 from annamitr/2.0/bug/FixlayoutTabs
Browse files Browse the repository at this point in the history
[#674416] Fix display selected tab
  • Loading branch information
stasguryev committed Apr 27, 2021
2 parents 7dab87a + e39d275 commit 7276de4
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 2 deletions.
3 changes: 2 additions & 1 deletion resources/styles/baseStyles.css
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@
.selected .dd-list__i,
.dd-list__i:hover,
.time-dropdown__i:hover,
.popout-menu__i:hover .popout-menu__txt {
.popout-menu__i:hover .popout-menu__txt,
.popout-menu__i_selected .popout-menu__txt {
color: var(--theme-colors__primary);
}

Expand Down
4 changes: 3 additions & 1 deletion resources/styles/popout.css
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
cursor: pointer;
transition: background .3s ease-in-out, color .3s ease-in-out;
}
.popout-menu__i:hover {
.popout-menu__i:hover,
.popout-menu__i_selected {
background: var(--theme-colors__main);
}
.popout-menu__txt {
Expand All @@ -55,6 +56,7 @@
color: var(--theme-colors__text);
text-decoration: none;
}

.popout-menu__subtext {
color: var(--theme-colors__main_strong);
}
6 changes: 6 additions & 0 deletions src/dropdown/views/MenuItemView.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ export default Marionette.View.extend({
};
},

onRender() {
if (this.model.get('selected')) {
this.el.classList.add('popout-menu__i_selected');
}
},

events: {
click() {
this.trigger('execute', this.model);
Expand Down
6 changes: 6 additions & 0 deletions src/layout/tabLayout/HeaderItemView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ export default Marionette.View.extend({
this.el.setAttribute('id', this.model.id);
},

onAttach() {
if (this.model.get('selected')) {
this.__scrollIntoViewIfNeeded();
}
},

__applyClasses() {
this.$el.toggleClass('layout__tab-layout__header-view-item_selected', Boolean(this.model.get('selected')));
this.$el.toggleClass('layout__tab-layout__header-view-item_error', Boolean(this.model.get('error')));
Expand Down
1 change: 1 addition & 0 deletions src/layout/tabLayout/HeaderMenuPanelItemView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export default MenuItemView.extend({
},

onRender() {
MenuItemView.prototype.onRender.apply(this);
this.__applyClasses();
},

Expand Down

0 comments on commit 7276de4

Please sign in to comment.