gamebrary/src/components/NavHeader/NavHeader.vue

128 lines
3 KiB
Vue
Raw Normal View History

2018-10-19 05:15:28 +00:00
<template lang="html">
2018-12-21 21:52:11 +00:00
<nav :class="{ dark: darkModeEnabled }">
2019-02-16 04:45:14 +00:00
<button class="logo" v-if="isShareList">
<img src='/static/gamebrary-logo.png' />
GAMEBRARY
</button>
2018-11-21 02:43:10 +00:00
<router-link
2019-02-16 04:45:14 +00:00
v-else
2018-11-21 02:43:10 +00:00
tag="button"
class="logo"
2019-01-24 06:16:08 +00:00
:to="{ name: homeRoute }"
2018-11-21 02:43:10 +00:00
>
2019-01-11 21:27:07 +00:00
<img src='/static/gamebrary-logo.png' />
{{ logoText }}
2018-11-21 02:43:10 +00:00
</router-link>
2019-02-08 05:46:29 +00:00
<div class="links" v-if="user">
2019-02-21 17:03:43 +00:00
<modal title="Releases" large padded>
2019-02-21 19:31:24 +00:00
<button class="info filled small">
2019-02-08 05:46:29 +00:00
<i class="fas fa-bullhorn" />
What's new
2019-02-08 05:46:29 +00:00
</button>
<releases slot="content" />
</modal>
2019-02-21 18:54:13 +00:00
<modal
padded
title="Settings"
>
<button class="settings hollow small">
2019-02-21 18:54:13 +00:00
<i class="fas fa-cog" />
</button>
<settings slot="content" v-if="settings" />
</modal>
2019-02-08 05:46:29 +00:00
</div>
2018-10-19 05:15:28 +00:00
</nav>
</template>
<script>
2019-02-08 05:46:29 +00:00
import Releases from '@/components/Releases/Releases';
2019-02-05 07:31:40 +00:00
import Modal from '@/components/Modal/Modal';
2018-12-21 21:52:11 +00:00
import { mapState, mapGetters } from 'vuex';
2019-02-21 18:54:13 +00:00
import Settings from '@/components/Settings/Settings';
2018-10-19 05:15:28 +00:00
export default {
2019-02-05 07:31:40 +00:00
components: {
2019-02-08 05:46:29 +00:00
Releases,
2019-02-21 18:54:13 +00:00
Settings,
2019-02-05 07:31:40 +00:00
Modal,
},
2018-10-19 05:15:28 +00:00
computed: {
2019-02-21 18:54:13 +00:00
...mapState(['user', 'platform', 'settings']),
2018-12-21 21:52:11 +00:00
...mapGetters(['darkModeEnabled']),
2019-01-24 06:16:08 +00:00
isAuthRoute() {
return this.$route.name === 'auth';
},
2019-02-16 04:45:14 +00:00
isShareList() {
return this.$route.name === 'share-list';
},
logoText() {
return this.$route.name === 'game-board' && this.platform
? this.platform.name
: 'GAMEBRARY';
},
2019-01-24 06:16:08 +00:00
homeRoute() {
2019-02-06 06:57:20 +00:00
if (this.$route.name === 'game-detail' && this.platform) {
return 'game-board';
}
if (this.$route.name === 'game-board') {
return 'platforms';
}
return null;
2019-01-11 21:52:08 +00:00
},
2018-10-19 05:15:28 +00:00
},
};
</script>
<style lang="scss" rel="stylesheet/scss" scoped>
@import "~styles/styles.scss";
nav {
2018-11-08 03:49:04 +00:00
user-select: none;
width: 100vw;
2018-11-17 22:23:33 +00:00
height: $navHeight;
2018-10-19 05:15:28 +00:00
display: flex;
justify-content: space-between;
align-items: center;
2019-02-08 05:46:29 +00:00
padding: 0 $gp;
2018-10-29 23:53:49 +00:00
.logo {
2018-11-08 03:49:04 +00:00
height: $navHeight;
2018-10-29 23:53:49 +00:00
font-weight: bold;
2019-01-11 21:27:07 +00:00
display: flex;
align-items: center;
2019-02-08 05:46:29 +00:00
margin-left: -$gp;
2019-01-11 21:27:07 +00:00
img {
height: 24px;
margin-right: $gp / 4;
}
2018-11-08 03:49:04 +00:00
}
2018-11-17 22:23:33 +00:00
&.dark {
background: $color-darkest-gray;
color: $color-gray !important;
2018-10-19 05:15:28 +00:00
}
2019-02-08 05:46:29 +00:00
.links {
display: flex;
align-items: center;
}
.settings {
margin-left: $gp;
}
2018-10-19 05:15:28 +00:00
}
</style>
2018-11-21 02:39:49 +00:00