Newer
Older
<div>
<b-navbar toggleable="lg" type="dark" variant="info">
<b-navbar-brand href="#" class="d-none d-md-block" v-on:click="showMainPage">Group Membership Service</b-navbar-brand>
<b-navbar-toggle target="nav-collapse"></b-navbar-toggle>
<b-collapse id="nav-collapse" is-nav>
<!-- Right aligned nav items -->
<b-navbar-nav class="ml-auto">
<b-nav-form>
<b-form-input size="sm" class="mr-sm-2" placeholder="Search" v-model="input.genericSearch.filter" @keydown.native.enter="genericSearch"></b-form-input>
<b-button size="sm" class="my-2 my-sm-0" type="button" v-on:click="genericSearch()">Search</b-button>
<b-nav-item-dropdown :text="user" right v-if="user">
<b-dropdown-item href="logout">Logout</b-dropdown-item>
</b-nav-item-dropdown>
</b-navbar-nav>
</b-collapse>
</b-navbar>
</div>
import client from 'api-client';
import {
mapState
} from 'vuex';
export default {
name: 'TopMenu',
props: {
user: String
},
computed: mapState({
input: state => state.input,
}),
methods: {
showMainPage() {
this.$store.commit('showMainPage');
},
genericSearch(event) {
// prevent the page reload if enter is pressed
if (event) {
event.preventDefault();
}
this.input.genericSearch.page = 1;
this.input.genericSearch.pageSize = 20;
client.search(this.input)
.then(results => {
this.$store.commit('displaySearchResults', results);
});
}
<style>
.navbar-dark .nav-link {
color: rgba(255, 255, 255, .7);
font-weight: bold;
}
</style>