UX: Position topic admin menu next to wrench (#9932)

This commit is contained in:
Penar Musaraj 2020-05-30 15:32:57 -04:00 committed by GitHub
parent e1af91f5ae
commit f2647f1f36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 2 deletions

View File

@ -90,19 +90,31 @@ createWidget("topic-admin-menu-button", {
$button = $(e.target).closest("button");
}
const position = $button.position();
const position = $button.position(),
SPACING = 3,
MENU_WIDTH = 217;
const rtl = $("html").hasClass("rtl");
position.outerHeight = $button.outerHeight();
if (rtl) {
position.left -= 217 - $button.outerWidth();
position.left -= MENU_WIDTH - $button.outerWidth();
}
if (this.attrs.fixed) {
position.left += $button.width() - 203;
}
if (this.attrs.openUpwards) {
if (rtl) {
position.left -= $button[0].offsetWidth + SPACING;
} else {
position.left += $button[0].offsetWidth + SPACING;
}
} else {
position.top += $button[0].offsetHeight + SPACING;
}
if (this.site.mobileView && !this.attrs.rightSide) {
const headerCloak = document.querySelector(".header-cloak");
if (headerCloak) headerCloak.style.display = "block";