2423 - Hide left menu #691

Merged
carlosjr merged 8 commits from 2423-hide_leftMenu into dev 2021-10-19 07:56:25 +00:00
4 changed files with 26 additions and 4 deletions

View File

@ -3,7 +3,7 @@
icon="menu" icon="menu"
class="show-menu" class="show-menu"
ng-if="$ctrl.leftMenu" ng-if="$ctrl.leftMenu"
ng-click="$ctrl.leftMenu.show()"> ng-click="$ctrl.leftMenu.toggle()">
</vn-icon-button> </vn-icon-button>
<div class="side start"> <div class="side start">
<a class="logo" ui-sref="home" title="{{'Home' | translate}}"> <a class="logo" ui-sref="home" title="{{'Home' | translate}}">

View File

@ -48,6 +48,10 @@ vn-layout {
.show-menu { .show-menu {
display: none; display: none;
} }
& > .show-menu {
margin-right: 5px;
display: block
}
.vn-button { .vn-button {
color: inherit; color: inherit;
font-size: 1.05rem; font-size: 1.05rem;
@ -71,6 +75,10 @@ vn-layout {
& > .main-view { & > .main-view {
padding-left: $menu-width; padding-left: $menu-width;
} }
&.shown > .main-view {
padding-left: 0;
}
} }
&.right-menu { &.right-menu {
& > vn-topbar > .end { & > vn-topbar > .end {
@ -85,6 +93,8 @@ vn-layout {
} }
& > .main-view { & > .main-view {
padding-top: $topbar-height; padding-top: $topbar-height;
transition: padding-left 200ms ease-out;
} }
ui-view { ui-view {
& > * { & > * {
@ -134,7 +144,8 @@ vn-layout {
& > vn-topbar { & > vn-topbar {
left: 0; left: 0;
} }
& > .main-view { & > .main-view,
&.shown > .main-view {
padding-left: 0; padding-left: 0;
} }
} }

View File

@ -52,12 +52,18 @@ export default class SideMenu extends Component {
this.hide(); this.hide();
} }
toggle() {
if (this.shown) this.hide();
else this.show();
}
show() { show() {
if (this.shown) return; if (this.shown) return;
this.shown = true; this.shown = true;
this.handler = e => this.onEscape(e); this.handler = e => this.onEscape(e);
this.$window.addEventListener('keydown', this.handler); this.$window.addEventListener('keydown', this.handler);
this.stateHandler = this.$transitions.onStart({}, t => this.onTransition(t)); this.stateHandler = this.$transitions.onStart({}, t => this.onTransition(t));
this.layout.element.classList.add('shown');
} }
hide() { hide() {
@ -65,6 +71,7 @@ export default class SideMenu extends Component {
this.$window.removeEventListener('keydown', this.handler); this.$window.removeEventListener('keydown', this.handler);
this.stateHandler(); this.stateHandler();
this.shown = false; this.shown = false;
this.layout.element.classList.remove('shown');
} }
} }

View File

@ -14,16 +14,20 @@ vn-side-menu > .menu {
box-shadow: 0 1px 3px $color-shadow; box-shadow: 0 1px 3px $color-shadow;
overflow: auto; overflow: auto;
top: $topbar-height; top: $topbar-height;
transition: transform 200ms ease-out;
&.left { &.left {
left: 0; left: 0
} }
&.right { &.right {
right: 0; right: 0;
} }
&.shown {
transform: translateZ(0) translateX(-$menu-width);
}
@media screen and (max-width: $mobile-width) { @media screen and (max-width: $mobile-width) {
transition: transform 200ms ease-out;
z-index: 15; z-index: 15;
top: 0; top: 0;