gamebrary/src/components/NavHeader/NavHeader.vue

85 lines
1.9 KiB
Vue
Raw Normal View History

2018-10-19 05:15:28 +00:00
<template lang="html">
2018-11-02 01:42:43 +00:00
<nav :style="navStyle" :class="{ dark: settings.nightMode }" v-if="user">
2018-10-29 23:53:49 +00:00
<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-11-02 01:42:43 +00:00
<router-link
:to="{ name: 'home' }"
tag="button"
v-else
>
<i class="fas fa-chevron-left" v-if="platform" />
</router-link>
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: {
2018-11-02 01:42:43 +00:00
...mapState(['user', 'platform', 'settings']),
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-11-02 01:42:43 +00:00
&.dark {
background: #333 !important;
color: $color-gray !important;
}
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>