DEV: Reorder appending extra header icons (#9973)

This commit is contained in:
Mark VanLandingham 2020-06-03 14:28:02 -05:00 committed by GitHub
parent 3e7f7fdde8
commit c200238bdc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,9 +21,12 @@ export function addToHeaderIcons(icon) {
const dropdown = {
buildClasses(attrs) {
let classes = attrs.classNames || [];
if (attrs.active) {
return "active";
classes.push("active");
}
return classes;
},
click(e) {
@ -189,6 +192,26 @@ createWidget("header-icons", {
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", {
title: "hamburger_menu",
icon: "bars",
@ -196,6 +219,8 @@ createWidget("header-icons", {
active: attrs.hamburgerVisible,
action: "toggleHamburger",
href: "",
classNames: ["hamburger-dropdown"],
contents() {
let { currentUser } = this;
if (currentUser && currentUser.reviewable_count) {
@ -212,16 +237,8 @@ createWidget("header-icons", {
}
});
const search = this.attach("header-dropdown", {
title: "search.title",
icon: "search",
iconId: "search-button",
action: "toggleSearchMenu",
active: attrs.searchVisible,
href: getURL("/search")
});
icons.push(hamburger);
const icons = [search, hamburger];
if (attrs.user) {
icons.push(
this.attach("user-dropdown", {
@ -233,12 +250,6 @@ createWidget("header-icons", {
);
}
if (_extraHeaderIcons) {
_extraHeaderIcons.forEach(icon => {
icons.push(this.attach(icon));
});
}
return icons;
}
});