mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 18:30:26 -06:00
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 = {
|
||||
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;
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user