gamebrary/src/components/NavHeader/NavHeader.vue

152 lines
3.4 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 }">
2018-11-21 02:43:10 +00:00
<router-link
tag="button"
class="logo"
:to="{ name: isHome ? 'platforms' : 'home' }"
>
GAMEBRARY
</router-link>
<div class="share">
<button
@click="showShareModal"
v-if="showShareUrl"
title="Share"
>
<i class="fas fa-share-alt" />
</button>
<router-link
v-if="showSettings"
tag="button"
:to="{ name: 'settings' }"
>
<i class="fas fa-cog" />
</router-link>
</div>
2018-10-19 05:15:28 +00:00
</nav>
</template>
<script>
2018-11-29 06:05:43 +00:00
import { swal } from '@/shared/modals';
2018-12-21 21:52:11 +00:00
import { mapState, mapGetters } from 'vuex';
2018-10-19 05:15:28 +00:00
export default {
computed: {
2018-12-21 21:52:11 +00:00
...mapState(['user', 'platform']),
...mapGetters(['darkModeEnabled']),
2018-11-21 02:43:10 +00:00
isHome() {
return this.$route.name === 'home';
},
showSettings() {
return this.$route.name !== 'settings';
},
2018-11-21 02:43:10 +00:00
showShareUrl() {
return this.$route.name === 'home' && this.platform;
},
shareUrl() {
const url = process.env.NODE_ENV === 'development'
? 'http://localhost:3000'
: 'https://gamebrary.com';
2018-12-11 02:14:01 +00:00
return `${url}/#/s/${this.user.uid}/${this.platform.code}`;
2018-11-21 02:43:10 +00:00
},
2018-11-08 03:49:04 +00:00
},
methods: {
2018-11-21 02:39:49 +00:00
showShareModal() {
swal({
titleText: 'Share your list',
html: 'Use the following URL to share this list.',
input: 'url',
inputValue: this.shareUrl,
showConfirmButton: false,
});
},
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;
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-21 02:43:10 +00:00
.share {
2018-11-29 06:05:43 +00:00
position: absolute;
top: 0;
right: 0;
button {
height: $navHeight;
}
2018-11-21 02:43:10 +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 {
a {
color: $color-gray;
2018-11-08 03:49:04 +00:00
}
2018-11-18 22:27:47 +00:00
}
.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
}
2018-11-19 02:20:17 +00:00
main {
height: 100vh;
border-right: 2px solid $color-light-gray;
2018-11-17 22:23:33 +00:00
display: flex;
flex-direction: column;
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>
2018-11-21 02:39:49 +00:00
<style lang="scss" rel="stylesheet/scss">
.swal2-input {
font-size: 10px !important;
}
</style>