c3lf-system-3/src/components/Navbar.vue

70 lines
2.8 KiB
Vue
Raw Normal View History

2019-11-14 02:59:17 +00:00
<template>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark sticky-top">
<div class="dropdown">
<button class="btn text-light dropdown-toggle" type="button" id="dropdownMenuButton"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
{{ activeEvent }}
</button>
<div class="dropdown-menu bg-dark" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item text-light" href="#" v-for="(event, index) in events" v-bind:key="index"
2019-11-14 03:14:47 +00:00
:class="{ active: event === activeEvent }" @click="changeEvent(event)">{{ event }}</a>
2019-11-14 02:59:17 +00:00
</div>
</div>
2019-11-14 03:24:36 +00:00
<div class="custom-control-inline mr-1">
2019-11-14 02:59:17 +00:00
<button type="button" class="btn mx-1 text-nowrap" v-for="(button, index) in buttons" v-bind:key="index" :class="['btn-' + button.color]">
<font-awesome-icon :icon="button.icon"/><span class="d-none d-md-inline">&nbsp;{{ button.title }}</span>
2019-11-14 02:59:17 +00:00
</button>
2019-11-15 19:00:40 +00:00
<div class="btn-group btn-group-toggle">
<button :class="['btn', 'btn-info', { active: layout === 'cards' }]" @click="setLayout('cards')">
<font-awesome-icon icon="th"/>
</button>
<button :class="['btn', 'btn-info', { active: layout === 'table' }]" @click="setLayout('table')">
<font-awesome-icon icon="list"/>
</button>
</div>
2019-11-14 02:59:17 +00:00
</div>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<form class="form-inline mt-1 my-lg-auto my-xl-auto w-100 d-inline">
<input class="form-control w-100" type="search" placeholder="Search" aria-label="Search">
</form>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ml-auto">
<li class="nav-item" v-for="(link, index) in links" v-bind:key="index">
<a class="nav-link text-nowrap" href="#">{{ link }}</a>
</li>
</ul>
</div>
</nav>
</template>
<script>
2019-11-15 19:00:40 +00:00
import { mapState, mapActions, mapMutations } from 'vuex';
2019-11-14 02:59:17 +00:00
export default {
name: 'Navbar',
data: () => ({
2019-11-29 00:21:44 +00:00
links: ['items', 'boxes', 'mass-edit', 'howto engel'],
2019-11-14 02:59:17 +00:00
buttons: [
{ title: 'Add', icon: 'plus', color: 'success' },
{ title: 'Refresh', icon: 'sync-alt', color: 'primary' },
]
}),
computed: {
2019-11-15 19:00:40 +00:00
...mapState(['events', 'activeEvent', 'layout']),
2019-11-14 03:14:47 +00:00
},
methods: {
2019-11-15 19:00:40 +00:00
...mapActions(['changeEvent']),
...mapMutations(['setLayout'])
2019-11-14 02:59:17 +00:00
}
};
</script>