Skip to content

Commit

Permalink
fix(ui5-shellbar): check for profile correctly (#1438)
Browse files Browse the repository at this point in the history
  • Loading branch information
vladitasev committed Apr 7, 2020
1 parent 28cc988 commit a4f502b
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions packages/fiori/src/ShellBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ class ShellBar extends UI5Element {
const newItems = this._getAllItems(hasIcons).map(info => {
const isOverflowIcon = info.classes.indexOf("ui5-shellbar-overflow-button") !== -1;
const isImageIcon = info.classes.indexOf("ui5-shellbar-image-button") !== -1;
const shouldStayOnScreen = isOverflowIcon || (isImageIcon && this.profile);
const shouldStayOnScreen = isOverflowIcon || (isImageIcon && this.hasProfile);

return Object.assign({}, info, {
classes: `${info.classes} ${shouldStayOnScreen ? "" : "ui5-shellbar-hidden-button"} ui5-shellbar-button`,
Expand Down Expand Up @@ -785,14 +785,14 @@ class ShellBar extends UI5Element {
},
{
text: "Person",
classes: `${this.profile ? "" : "ui5-shellbar-invisible-button"} ui5-shellbar-image-button ui5-shellbar-button`,
classes: `${this.hasProfile ? "" : "ui5-shellbar-invisible-button"} ui5-shellbar-image-button ui5-shellbar-button`,
priority: 4,
subclasses: "ui5-shellbar-image-buttonImage",
style: `order: ${this.profile ? 5 : -10};`,
style: `order: ${this.hasProfile ? 5 : -10};`,
profile: true,
id: `${this._id}-item-${3}`,
domOrder: this.profile ? (++domOrder) : -1,
show: this.profile,
domOrder: this.hasProfile ? (++domOrder) : -1,
show: this.hasProfile,
press: this._handleProfilePress.bind(this),
_tabIndex: "-1",
},
Expand Down Expand Up @@ -863,6 +863,10 @@ class ShellBar extends UI5Element {
return getRTL() ? "rtl" : undefined;
}

get hasProfile() {
return !!this.profile.length;
}

static async onDefine() {
await Promise.all([
Icon.define(),
Expand Down

0 comments on commit a4f502b

Please sign in to comment.