Stackedit/src/components/SideBar.vue

100 lines
2.2 KiB
Vue
Raw Normal View History

2017-07-23 18:42:08 +00:00
<template>
2017-08-04 08:20:50 +00:00
<div class="side-bar flex flex--column">
<div class="side-title flex flex--row flex--space-between">
<div class="flex flex--row">
2017-08-04 20:46:06 +00:00
<button v-if="panel !== 'menu'" class="side-title__button button" @click="panel = 'menu'">
<icon-arrow-left></icon-arrow-left>
</button>
2017-08-04 08:20:50 +00:00
<div class="side-title__title">
2017-08-04 20:46:06 +00:00
{{panelName}}
2017-08-04 08:20:50 +00:00
</div>
</div>
<button class="side-title__button button" @click="toggleSideBar(false)">
<icon-close></icon-close>
</button>
</div>
2017-08-04 20:46:06 +00:00
<div class="side-bar__inner">
<div v-if="panel === 'menu'" class="side-bar__panel side-bar__panel--menu">
<menu-item>
<icon-login slot="icon"></icon-login>
<div>Sign in with Google</div>
<span>Have all your files and settings backed up and synced.</span>
</menu-item>
<menu-item @click.native="panel = 'toc'">
<icon-toc slot="icon"></icon-toc>
Table of Contents
</menu-item>
<menu-item @click.native="panel = 'help'">
<icon-help-circle slot="icon"></icon-help-circle>
Markdown help
</menu-item>
</div>
<div class="side-bar__panel side-bar__panel--toc" :class="{'side-bar__panel--hidden': panel !== 'toc'}">
<toc>
</toc>
</div>
2017-08-04 08:20:50 +00:00
</div>
2017-07-23 18:42:08 +00:00
</div>
</template>
<script>
2017-08-04 08:20:50 +00:00
import { mapActions } from 'vuex';
2017-07-23 18:42:08 +00:00
import Toc from './Toc';
2017-08-04 20:46:06 +00:00
import MenuItem from './MenuItem';
const panelNames = {
menu: 'Menu',
help: 'Markdown help',
toc: 'Table of Contents',
};
2017-07-23 18:42:08 +00:00
export default {
components: {
Toc,
2017-08-04 20:46:06 +00:00
MenuItem,
},
data: () => ({
panel: 'menu',
panelNames: {
menu: 'Menu',
toc: 'Table of Contents',
},
}),
computed: {
panelName() {
return panelNames[this.panel];
},
2017-07-23 18:42:08 +00:00
},
2017-08-04 08:20:50 +00:00
methods: {
...mapActions('data', [
'toggleSideBar',
]),
},
2017-07-23 18:42:08 +00:00
};
</script>
2017-08-04 08:20:50 +00:00
<style lang="scss">
@import 'common/variables.scss';
.side-bar {
overflow: hidden;
2017-08-04 20:46:06 +00:00
height: 100%;
}
.side-bar__inner {
overflow: auto;
height: 100%;
padding: 10px 0;
2017-08-04 08:20:50 +00:00
}
.side-bar__panel {
position: absolute;
width: 100%;
height: 100%;
}
2017-08-04 20:46:06 +00:00
.side-bar__panel--hidden {
2017-08-04 08:20:50 +00:00
left: 1000px;
}
</style>