DEV: Reorder appending extra header icons (#9973)
This commit is contained in:
parent
3e7f7fdde8
commit
c200238bdc
|
@ -21,9 +21,12 @@ export function addToHeaderIcons(icon) {
|
||||||
|
|
||||||
const dropdown = {
|
const dropdown = {
|
||||||
buildClasses(attrs) {
|
buildClasses(attrs) {
|
||||||
|
let classes = attrs.classNames || [];
|
||||||
if (attrs.active) {
|
if (attrs.active) {
|
||||||
return "active";
|
classes.push("active");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return classes;
|
||||||
},
|
},
|
||||||
|
|
||||||
click(e) {
|
click(e) {
|
||||||
|
@ -189,6 +192,26 @@ createWidget("header-icons", {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const icons = [];
|
||||||
|
|
||||||
|
if (_extraHeaderIcons) {
|
||||||
|
_extraHeaderIcons.forEach(icon => {
|
||||||
|
icons.push(this.attach(icon));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const search = this.attach("header-dropdown", {
|
||||||
|
title: "search.title",
|
||||||
|
icon: "search",
|
||||||
|
iconId: "search-button",
|
||||||
|
action: "toggleSearchMenu",
|
||||||
|
active: attrs.searchVisible,
|
||||||
|
href: getURL("/search"),
|
||||||
|
classNames: ["search-dropdown"]
|
||||||
|
});
|
||||||
|
|
||||||
|
icons.push(search);
|
||||||
|
|
||||||
const hamburger = this.attach("header-dropdown", {
|
const hamburger = this.attach("header-dropdown", {
|
||||||
title: "hamburger_menu",
|
title: "hamburger_menu",
|
||||||
icon: "bars",
|
icon: "bars",
|
||||||
|
@ -196,6 +219,8 @@ createWidget("header-icons", {
|
||||||
active: attrs.hamburgerVisible,
|
active: attrs.hamburgerVisible,
|
||||||
action: "toggleHamburger",
|
action: "toggleHamburger",
|
||||||
href: "",
|
href: "",
|
||||||
|
classNames: ["hamburger-dropdown"],
|
||||||
|
|
||||||
contents() {
|
contents() {
|
||||||
let { currentUser } = this;
|
let { currentUser } = this;
|
||||||
if (currentUser && currentUser.reviewable_count) {
|
if (currentUser && currentUser.reviewable_count) {
|
||||||
|
@ -212,16 +237,8 @@ createWidget("header-icons", {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const search = this.attach("header-dropdown", {
|
icons.push(hamburger);
|
||||||
title: "search.title",
|
|
||||||
icon: "search",
|
|
||||||
iconId: "search-button",
|
|
||||||
action: "toggleSearchMenu",
|
|
||||||
active: attrs.searchVisible,
|
|
||||||
href: getURL("/search")
|
|
||||||
});
|
|
||||||
|
|
||||||
const icons = [search, hamburger];
|
|
||||||
if (attrs.user) {
|
if (attrs.user) {
|
||||||
icons.push(
|
icons.push(
|
||||||
this.attach("user-dropdown", {
|
this.attach("user-dropdown", {
|
||||||
|
@ -233,12 +250,6 @@ createWidget("header-icons", {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_extraHeaderIcons) {
|
|
||||||
_extraHeaderIcons.forEach(icon => {
|
|
||||||
icons.push(this.attach(icon));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return icons;
|
return icons;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue