Removed sidebar toggle button, clicking the active panel icon will now close the sidebar.
This commit is contained in:
parent
fc5952dda9
commit
556a8cb51d
3 changed files with 8 additions and 41 deletions
src/mami.js
|
@ -38,7 +38,6 @@ window.Umi = { UI: {} };
|
|||
#include sidebar/act-ping.jsx
|
||||
#include sidebar/act-scroll.jsx
|
||||
#include sidebar/act-sound.jsx
|
||||
#include sidebar/act-toggle.jsx
|
||||
#include sidebar/pan-channels.jsx
|
||||
#include sidebar/pan-settings.jsx
|
||||
#include sidebar/pan-uploads.jsx
|
||||
|
@ -246,6 +245,7 @@ const MamiInit = async args => {
|
|||
ctx.textTriggers = new MamiTextTriggers;
|
||||
|
||||
const sidebar = new MamiSidebar;
|
||||
sidebar.toggle(window.innerWidth > 800);
|
||||
|
||||
MamiCompat('Umi.UI.Menus.Add', {
|
||||
value: (baseId, title) => {
|
||||
|
@ -659,11 +659,6 @@ const MamiInit = async args => {
|
|||
const sbUploads = new MamiSidebarPanelUploads;
|
||||
sidebar.createPanel(sbUploads);
|
||||
|
||||
const sbActToggle = new MamiSidebarActionToggle(sidebar);
|
||||
sidebar.createAction(sbActToggle);
|
||||
if(window.innerWidth < 800)
|
||||
sbActToggle.click();
|
||||
|
||||
sidebar.createAction(new MamiSidebarActionScroll(settings));
|
||||
sidebar.createAction(new MamiSidebarActionSound(settings));
|
||||
sidebar.createAction(new MamiSidebarActionCollapseAll);
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
#include animate.js
|
||||
|
||||
const MamiSidebarActionToggle = function(sidebar) {
|
||||
const toggleClose = <i class="fas fa-caret-square-right sidebar-gutter-font-icon"/>;
|
||||
const toggleOpen = <i class="hidden fas fa-caret-square-left sidebar-gutter-font-icon"/>;
|
||||
|
||||
let buttonElem;
|
||||
|
||||
sidebar.frame.watch('mami:sidebar:toggle', ev => {
|
||||
toggleClose.classList.toggle('hidden', !ev.detail.open);
|
||||
toggleOpen.classList.toggle('hidden', ev.detail.open);
|
||||
});
|
||||
|
||||
return {
|
||||
get name() { return 'act:toggle'; },
|
||||
get text() { return 'Toggle sidebar'; },
|
||||
|
||||
click: () => {
|
||||
buttonElem?.click();
|
||||
},
|
||||
|
||||
createdButton: button => {
|
||||
buttonElem = button.element;
|
||||
buttonElem.append(toggleClose, toggleOpen);
|
||||
},
|
||||
|
||||
onclick: async () => {
|
||||
try {
|
||||
await sidebar.toggle();
|
||||
} catch(ex) {}
|
||||
},
|
||||
};
|
||||
};
|
|
@ -274,8 +274,13 @@ const MamiSidebar = function() {
|
|||
if(info.onclick === undefined)
|
||||
info.onclick = async name => {
|
||||
try {
|
||||
switchPanel(name);
|
||||
frame.toggle(true);
|
||||
if(frame.isOpen && frame.activePanelName === info.name) {
|
||||
gutter.setActiveButton();
|
||||
frame.toggle(false);
|
||||
} else {
|
||||
switchPanel(name);
|
||||
frame.toggle(true);
|
||||
}
|
||||
} catch(ex) {}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue