gamebrary/src/components/NavHeader/NavHeader.vue

209 lines
5.3 KiB
Vue
Raw Normal View History

2018-10-19 05:15:28 +00:00
<template lang="html">
2018-11-17 22:23:33 +00:00
<nav :class="{ dark: settings && settings.nightMode }">
<slide width="300">
2018-11-08 03:49:04 +00:00
<div class="profile">
<gravatar :email="user.email" />
<div class="info">
<strong>{{ user.displayName }}</strong>
{{ user.email }}
</div>
</div>
<div class="actions">
<section>
<router-link :to="{ name: 'home' }">
<i class="fas fa-home" />
Home
</router-link>
<router-link :to="{ name: 'platforms' }" v-if="platform">
<i class="fas fa-exchange-alt" />
Change platform
</router-link>
<router-link :to="{ name: 'settings' }">
<i class="fas fa-cog" />
Settings
</router-link>
</section>
<section>
<a href="https://www.paypal.me/RomanCervantes/5" target="_blank">
<i class="fas fa-donate" />
Donate
</a>
<a href="https://github.com/romancmx/gamebrary/issues" target="_blank">
<i class="fas fa-bug" />
Report bugs
</a>
<a href="https://goo.gl/forms/r0juBCsZaUtJ03qb2" target="_blank">
<i class="fas fa-comments" />
Submit feedback
</a>
</section>
<section>
<a @click="signOut">
<i class="fas fa-sign-out-alt" />
Sign out
</a>
</section>
</div>
<p>&copy; 2018 Gamebrary</p>
2018-11-17 22:23:33 +00:00
</slide>
<router-link tag="button" class="logo" :to="{ name: 'home' }">
GAMEBRARY
</router-link>
2018-10-19 05:15:28 +00:00
</nav>
</template>
<script>
2018-11-08 03:49:04 +00:00
import Gravatar from 'vue-gravatar';
import firebase from 'firebase/app';
import 'firebase/auth';
2018-11-17 22:23:33 +00:00
import { Slide } from 'vue-burger-menu';
import { mapState } from 'vuex';
2018-10-19 05:15:28 +00:00
export default {
2018-11-08 03:49:04 +00:00
components: {
Gravatar,
2018-11-17 22:23:33 +00:00
Slide,
2018-11-08 03:49:04 +00:00
},
2018-10-19 05:15:28 +00:00
computed: {
2018-11-02 01:42:43 +00:00
...mapState(['user', 'platform', 'settings']),
2018-10-29 23:53:49 +00:00
routeName() {
return this.$route.name;
},
2018-11-08 03:49:04 +00:00
platformLogo() {
return this.platform.useAlt
? `/static/img/platforms/${this.platform.code}-alt.svg`
: `/static/img/platforms/${this.platform.code}.svg`;
},
},
methods: {
signOut() {
firebase.auth().signOut()
.then(() => {
this.$store.commit('CLEAR_SESSION');
this.$router.push({ name: 'home' });
})
.catch((error) => {
this.$error(error);
});
},
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;
position: fixed;
z-index: 1;
width: 100vw;
2018-11-17 22:23:33 +00:00
height: $navHeight;
2018-10-19 05:15:28 +00:00
display: flex;
2018-11-08 03:49:04 +00:00
justify-content: center;
2018-11-17 22:23:33 +00:00
background: $color-white;
2018-11-08 03:49:04 +00:00
color: $color-dark-gray;
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;
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-11-08 03:49:04 +00:00
2018-11-17 22:23:33 +00:00
.actions {
section {
border-bottom: 1px solid $color-dark-gray;
}
2018-11-08 03:49:04 +00:00
2018-11-17 22:23:33 +00:00
a {
color: $color-gray;
2018-11-08 03:49:04 +00:00
}
2018-11-17 22:23:33 +00:00
i, img {
2018-11-18 22:27:47 +00:00
// background: $color-dark-gray;
// border: 2px solid $color-gray;
}
}
.profile {
background: $color-darkest-gray;
.info {
color: $color-gray;
2018-11-17 22:23:33 +00:00
}
2018-11-08 03:49:04 +00:00
}
}
2018-11-17 22:23:33 +00:00
}
.profile {
display: flex;
align-items: center;
background: $color-white;
2018-11-08 03:49:04 +00:00
2018-11-17 22:23:33 +00:00
.info {
2018-11-08 03:49:04 +00:00
display: flex;
flex-direction: column;
2018-11-17 22:23:33 +00:00
margin-left: $gp;
color: $color-dark-gray;
2018-10-19 05:15:28 +00:00
}
2018-11-17 22:23:33 +00:00
img {
2018-11-18 22:27:47 +00:00
width: 40px;
height: 40px;
2018-11-17 22:23:33 +00:00
border-radius: 100%;
border: 2px solid $color-white;
box-shadow: 0 0 2px 0px $color-dark-gray;
2018-11-08 03:49:04 +00:00
2018-11-17 22:23:33 +00:00
@media($small) {
width: 40px;
height: 40px;
2018-11-08 03:49:04 +00:00
}
}
2018-11-17 22:23:33 +00:00
}
2018-11-08 03:49:04 +00:00
2018-11-17 22:23:33 +00:00
.actions {
display: flex;
flex-direction: column;
2018-11-08 03:49:04 +00:00
2018-11-17 22:23:33 +00:00
section {
width: 100%;
border-bottom: 1px solid $color-light-gray;
margin-bottom: $gp;
}
2018-11-08 03:49:04 +00:00
2018-11-17 22:23:33 +00:00
a {
color: $color-dark-gray;
2018-11-18 22:27:47 +00:00
grid-template-columns: 40px auto;
margin-bottom: $gp / 2;
2018-11-17 22:23:33 +00:00
display: grid;
align-items: center;
text-decoration: none;
}
i, img {
2018-11-18 22:27:47 +00:00
width: 40px;
height: 40px;
2018-11-17 22:23:33 +00:00
text-align: center;
justify-content: center;
align-items: center;
display: flex;
2018-10-19 05:15:28 +00:00
}
}
</style>