Added sidebar toggle

This commit is contained in:
Joel Collins 2019-02-07 16:47:09 +00:00
parent 5ca9e3d053
commit 79f094066e
3 changed files with 75 additions and 7 deletions

View file

@ -1,6 +1,19 @@
<template>
<div id="app">
<panelLeft/>
<div v-bind:class="responsiveToggleButton" id="overlay-toggle">
<a href="" class="uk-icon-button" uk-icon="menu" uk-toggle="target: .toggle-hidden; animation: uk-animation-slide-left-small, uk-animation-slide-left-small" ></a>
</div>
<div uk-grid class="uk-height-1-1" margin=0>
<div v-bind:class="responsivePanelLeft" class="toggle-hidden uk-card uk-card-default uk-card-body uk-padding-remove-top uk-padding-remove-right uk-width-auto uk-height-1-1">
<div class="uk-card-header">
<h3 class="uk-card-title"><b>OpenFlexure</b> Microscope</h3>
</div>
<panelLeft/>
</div>
<div class="uk-width-expand">
<div class="uk-card uk-card-default uk-card-body uk-height-1-1">Width: {{ window.width }}</div>
</div>
</div>
</div>
</template>
@ -19,9 +32,51 @@ import panelLeft from './components/panelLeft.vue'
// Export main app
export default {
name: 'app',
components: {
panelLeft
},
data: function () {
return {
window: {
width: 0,
height: 0
}
}
},
created: function () {
window.addEventListener('resize', this.handleResize)
this.handleResize();
},
beforeDestroy: function () {
window.removeEventListener('resize', this.handleResize)
},
methods: {
handleResize: function(event) {
this.window.width = window.innerWidth;
this.window.height = window.innerHeight;
}
},
computed: {
// Stylises the hostname input box based on connection status
responsivePanelLeft: function () {
return {
//'uk-hidden': this.window.width<850,
'overlay-panel': this.window.width<850
}
},
responsiveToggleButton: function () {
return {
//'uk-hidden': this.window.width>=850,
}
}
}
}
</script>
@ -42,4 +97,18 @@ body, html {
height: 100%
}
.overlay-panel {
position: fixed;
z-index: 99;
}
#overlay-toggle {
width: 30px;
height: 30px;
position: fixed;
right: 0;
margin: 20px;
z-index: 999
}
</style>