Basic mobile panel switcher.

This commit is contained in:
Roger Braun 2017-01-17 17:27:39 +01:00
parent 4213d84b4d
commit c7a375068d
3 changed files with 45 additions and 7 deletions

View File

@ -11,8 +11,16 @@ export default {
Notifications, Notifications,
StyleSwitcher StyleSwitcher
}, },
data: () => ({
mobileActivePanel: 'timeline'
}),
computed: { computed: {
currentUser () { return this.$store.state.users.currentUser }, currentUser () { return this.$store.state.users.currentUser },
style () { return { 'background-image': `url(${this.currentUser.background_image})` } } style () { return { 'background-image': `url(${this.currentUser.background_image})` } }
},
methods: {
activatePanel (panelName) {
this.mobileActivePanel = panelName
}
} }
} }

View File

@ -66,11 +66,6 @@ nav {
} }
} }
.sidebar {
flex: 1;
flex-basis: 300px;
}
main-router { main-router {
flex: 1; flex: 1;
} }
@ -230,3 +225,34 @@ nav {
flex: 2; flex: 2;
flex-basis: 500px; flex-basis: 500px;
} }
.sidebar {
flex: 1;
flex-basis: 300px;
}
.mobile-shown {
display: none;
}
.panel-switcher {
display: none;
width: 100%;
button {
display: block;
flex: 1;
margin: 0.5em;
padding: 0.5em;
}
}
@media all and (max-width: 959px) {
.mobile-hidden {
display: none;
}
.panel-switcher {
display: flex;
}
}

View File

@ -9,12 +9,16 @@
</div> </div>
</nav> </nav>
<div class="container" id="content"> <div class="container" id="content">
<div class="sidebar"> <div class="panel-switcher">
<button @click="activatePanel('sidebar')">Sidebar</button>
<button @click="activatePanel('timeline')">Timeline</button>
</div>
<div class="sidebar" :class="{ 'mobile-hidden': mobileActivePanel != 'sidebar' }">
<user-panel></user-panel> <user-panel></user-panel>
<nav-panel></nav-panel> <nav-panel></nav-panel>
<notifications v-if="currentUser"></notifications> <notifications v-if="currentUser"></notifications>
</div> </div>
<div class="main"> <div class="main" :class="{ 'mobile-hidden': mobileActivePanel != 'timeline' }">
<transition name="fade"> <transition name="fade">
<router-view></router-view> <router-view></router-view>
</transition> </transition>