-
-
Save cmawhorter/0d4a8d73d607d2f93de73588ded6b502 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const renderDrawer = vnode => { | |
const { showDrawer, backHref } = vnode.state; | |
const drawerContent = m('.v-blocks.fill', [ | |
!window.matchMedia('(min-width: 1001px)').matches ? null : [ | |
m('.pl-1', m('a.btn.btn-link.pl-0.text-muted', { | |
href: backHref, | |
oncreate: m.route.link, | |
}, m('i.fa.fa-close.mr-h'), 'Close designer')), | |
m('h1.h4.ma-1.mb-2', PAGE_TITLE), | |
], | |
m(Tabs, { | |
tabs: [ | |
{ _id: 'sections', label: 'Sections' }, | |
{ _id: 'settings', label: 'Theme' }, | |
], | |
onChange({ options }) { | |
// setTimeout(() => { | |
console.log('onChange body'); | |
vnode.state.selectedSidebarTab = options._id; | |
// when changing between tabs, reset tabs to their home state | |
clearSettingsBeingEdited(vnode); | |
// m.redraw(); | |
// }, 1000); | |
}, | |
}), | |
renderSidebarTabBody(vnode), | |
]); | |
if (window.matchMedia('(min-width: 1001px)').matches) { | |
vnode.state.showDrawer = null; | |
return m(Drawer, { | |
key: 'large:drawer', | |
className: 'full-height pt-1 pl-1 pb-1', | |
permanent: true, | |
show: true, | |
floating: true, | |
content: drawerContent, | |
}); | |
} | |
else { | |
return m(Drawer, { | |
key: 'small:drawer', | |
show: true === showDrawer, | |
cover: true, | |
backdrop: true, | |
content: drawerContent, | |
didHide: () => { | |
vnode.state.showDrawer = false; | |
}, | |
}); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment