fchat-rising/chat/Sidebar.vue

38 lines
1.3 KiB
Vue
Raw Permalink Normal View History

2018-01-06 16:14:21 +00:00
<template>
<div class="sidebar-wrapper" :class="{open: expanded}">
<div :class="'sidebar sidebar-' + (right ? 'right' : 'left')">
<button @click="expanded = !expanded" class="btn btn-secondary btn-xs expander" :aria-label="label">
<span :class="'fa fa-fw fa-rotate-270 ' + icon" v-if="right"></span>
2018-01-06 16:14:21 +00:00
<span class="fa" :class="{'fa-chevron-down': !expanded, 'fa-chevron-up': expanded}"></span>
<span :class="'fa fa-fw fa-rotate-90 ' + icon" v-if="!right"></span>
2018-01-06 16:14:21 +00:00
</button>
<div class="body">
<slot></slot>
</div>
</div>
<div class="modal-backdrop show" @click="expanded = false"></div>
2018-01-06 16:14:21 +00:00
</div>
</template>
<script lang="ts">
2019-01-03 17:38:17 +00:00
import {Component, Prop, Watch} from '@f-list/vue-ts';
2018-01-06 16:14:21 +00:00
import Vue from 'vue';
@Component
export default class Sidebar extends Vue {
2019-09-17 17:14:14 +00:00
@Prop
2018-01-06 16:14:21 +00:00
readonly right?: true;
2019-09-17 17:14:14 +00:00
@Prop
2018-01-06 16:14:21 +00:00
readonly label?: string;
@Prop({required: true})
readonly icon!: string;
2018-01-06 16:14:21 +00:00
@Prop({default: false})
readonly open!: boolean;
2018-01-06 16:14:21 +00:00
expanded = this.open;
@Watch('open')
watchOpen(): void {
this.expanded = this.open;
}
}
</script>