gamebrary/src/components/NavHeader/NavHeader.vue

72 lines
1.6 KiB
Vue
Raw Normal View History

2018-10-19 05:15:28 +00:00
<template lang="html">
2018-10-29 23:53:49 +00:00
<nav :style="navStyle" v-if="user">
<router-link
:to="{ name: 'platforms' }"
tag="button"
v-if="platform && routeName === 'home'"
>
{{ platform.name }}
</router-link>
2018-10-19 05:15:28 +00:00
2018-10-29 23:53:49 +00:00
<router-link
:to="{ name: 'home' }"
tag="button"
v-else-if="routeName === 'game-detail' || routeName === 'settings'"
>
<i class="fas fa-chevron-left" />
</router-link>
2018-10-19 05:15:28 +00:00
2018-10-29 23:53:49 +00:00
<router-link
v-if="routeName !== 'settings'"
:to="{ name: 'settings' }" tag="button"
>
<i class="fas fa-cog" />
</router-link>
2018-10-19 05:15:28 +00:00
</nav>
</template>
<script>
import { mapState } from 'vuex';
2018-10-19 05:15:28 +00:00
export default {
computed: {
...mapState(['user', 'platform']),
2018-10-29 23:53:49 +00:00
navStyle() {
return this.platform ? {
'background-color': this.platform.hex || '#555',
color: this.platform.textHex || '#fff',
} : '';
},
routeName() {
return this.$route.name;
},
2018-10-19 05:15:28 +00:00
},
};
</script>
<style lang="scss" rel="stylesheet/scss" scoped>
@import "~styles/styles.scss";
nav {
height: $navHeight;
width: 100%;
background: $color-dark-gray;
display: flex;
align-items: center;
2018-10-29 23:53:49 +00:00
justify-content: space-between;
color: $color-white;
2018-10-29 23:53:49 +00:00
transition: all 300ms ease;
2018-10-29 23:53:49 +00:00
.logo {
font-size: 18px;
font-weight: bold;
2018-10-19 05:15:28 +00:00
}
2018-10-29 23:53:49 +00:00
.small {
padding: 0;
2018-10-19 05:15:28 +00:00
}
}
</style>