Add top navigation bar (#25)
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
bc04fdbadb
commit
412bb56b32
6 changed files with 125 additions and 24 deletions
|
@ -1,6 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<main v-if="loaded">
|
<main v-if="loaded">
|
||||||
<TopBar v-if="!isFullscreen" />
|
|
||||||
<router-view />
|
<router-view />
|
||||||
</main>
|
</main>
|
||||||
<main class="loading-box" v-else>
|
<main class="loading-box" v-else>
|
||||||
|
@ -29,15 +28,12 @@ h1.loading-message {
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Component, Vue } from "vue-property-decorator";
|
import { Component, Vue } from "vue-property-decorator";
|
||||||
import { Action, Getter } from "vuex-class";
|
import { Action, Getter } from "vuex-class";
|
||||||
import TopBar from "@/components/Navigation/TopBar.vue";
|
|
||||||
import { loadSets } from "@/mlpccg/set";
|
import { loadSets } from "@/mlpccg/set";
|
||||||
import { AppState } from "./store/types";
|
import { AppState } from "./store/types";
|
||||||
import { getCards } from "./mlpccg/database";
|
import { getCards } from "./mlpccg/database";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
components: {
|
components: {}
|
||||||
TopBar
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
export default class App extends Vue {
|
export default class App extends Vue {
|
||||||
@Action showLoading!: (msg: string) => void;
|
@Action showLoading!: (msg: string) => void;
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
<template>
|
|
||||||
<nav></nav>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style lang="scss" scoped></style>
|
|
||||||
|
|
||||||
<script lang="ts">
|
|
||||||
import { Component, Vue } from "vue-property-decorator";
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
components: {}
|
|
||||||
})
|
|
||||||
export default class TopBar extends Vue {}
|
|
||||||
</script>
|
|
93
src/components/Navigation/TopNav.vue
Normal file
93
src/components/Navigation/TopNav.vue
Normal file
|
@ -0,0 +1,93 @@
|
||||||
|
<template>
|
||||||
|
<nav>
|
||||||
|
<router-link
|
||||||
|
:class="routeClass(route)"
|
||||||
|
v-for="route in routes"
|
||||||
|
:key="route"
|
||||||
|
:to="{ name: route }"
|
||||||
|
>{{ prettyTitle(route) }}</router-link
|
||||||
|
>
|
||||||
|
</nav>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
@import "@/assets/scss/_variables.scss";
|
||||||
|
|
||||||
|
nav {
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
display: flex;
|
||||||
|
background: linear-gradient(
|
||||||
|
to bottom,
|
||||||
|
rgba(200, 230, 250, 0.3),
|
||||||
|
rgba(100, 180, 255, 0.1)
|
||||||
|
);
|
||||||
|
|
||||||
|
.entry {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
height: 50px;
|
||||||
|
max-width: 300px;
|
||||||
|
text-align: center;
|
||||||
|
color: $grey-lighter;
|
||||||
|
|
||||||
|
border-right: 1px solid rgba(0, 50, 100, 0.5);
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: linear-gradient(
|
||||||
|
to bottom,
|
||||||
|
rgba(0, 0, 0, 0.5),
|
||||||
|
rgba(100, 100, 100, 0.1)
|
||||||
|
);
|
||||||
|
cursor: pointer;
|
||||||
|
color: $white;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.current,
|
||||||
|
&.current:hover {
|
||||||
|
background: linear-gradient(
|
||||||
|
to bottom,
|
||||||
|
rgba(0, 0, 0, 0.7),
|
||||||
|
rgba(100, 100, 100, 0.1)
|
||||||
|
);
|
||||||
|
color: $grey-lighter;
|
||||||
|
cursor: normal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import { Component, Vue } from "vue-property-decorator";
|
||||||
|
|
||||||
|
const routes = ["lobby", "deck-editor"];
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
components: {}
|
||||||
|
})
|
||||||
|
export default class TopNav extends Vue {
|
||||||
|
private routes!: string[];
|
||||||
|
|
||||||
|
private data() {
|
||||||
|
return {
|
||||||
|
routes
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private prettyTitle(name: string): string {
|
||||||
|
const route = this.$router.resolve({ name });
|
||||||
|
if (!route || !route.resolved.meta || !route.resolved.meta.topnav) {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
return route.resolved.meta.topnav;
|
||||||
|
}
|
||||||
|
|
||||||
|
private routeClass(name: string) {
|
||||||
|
return {
|
||||||
|
entry: true,
|
||||||
|
current: this.$route.name == name
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -21,7 +21,10 @@ export default new Router({
|
||||||
{
|
{
|
||||||
path: "/build",
|
path: "/build",
|
||||||
name: "deck-editor",
|
name: "deck-editor",
|
||||||
component: DeckBuilder
|
component: DeckBuilder,
|
||||||
|
meta: {
|
||||||
|
topnav: "Deck Builder"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/game",
|
path: "/game",
|
||||||
|
@ -36,7 +39,10 @@ export default new Router({
|
||||||
{
|
{
|
||||||
path: "/lobby",
|
path: "/lobby",
|
||||||
name: "lobby",
|
name: "lobby",
|
||||||
component: Lobby
|
component: Lobby,
|
||||||
|
meta: {
|
||||||
|
topnav: "Lobby"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/room",
|
path: "/room",
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<section class="deckbuilder">
|
<section class="deckbuilder">
|
||||||
|
<TopNav class="topnav" />
|
||||||
<section class="cardlist">
|
<section class="cardlist">
|
||||||
<section class="filters">
|
<section class="filters">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
@ -78,6 +79,11 @@
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 3fr minmax(250px, 1fr);
|
grid-template-columns: 3fr minmax(250px, 1fr);
|
||||||
|
grid-template-rows: auto 1fr;
|
||||||
|
}
|
||||||
|
|
||||||
|
.topnav {
|
||||||
|
grid-column: 1/3;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cardlist {
|
.cardlist {
|
||||||
|
@ -185,6 +191,7 @@
|
||||||
import { Component, Vue } from "vue-property-decorator";
|
import { Component, Vue } from "vue-property-decorator";
|
||||||
import DeckList from "@/components/DeckBuilder/DeckList.vue";
|
import DeckList from "@/components/DeckBuilder/DeckList.vue";
|
||||||
import CardPicker from "@/components/DeckBuilder/CardPicker.vue";
|
import CardPicker from "@/components/DeckBuilder/CardPicker.vue";
|
||||||
|
import TopNav from "@/components/Navigation/TopNav.vue";
|
||||||
import {
|
import {
|
||||||
Card,
|
Card,
|
||||||
CardFilter,
|
CardFilter,
|
||||||
|
@ -276,6 +283,7 @@ function sortByColor(a: Card, b: Card) {
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
components: {
|
components: {
|
||||||
|
TopNav,
|
||||||
DeckList,
|
DeckList,
|
||||||
CardPicker
|
CardPicker
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,26 @@
|
||||||
<template>
|
<template>
|
||||||
<section class="lobby"></section>
|
<section class="lobby">
|
||||||
|
<TopNav />
|
||||||
|
</section>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped></style>
|
<style lang="scss" scoped>
|
||||||
|
.lobby {
|
||||||
|
background: url("../assets/images/backgrounds/menubg.webp") center;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-size: cover;
|
||||||
|
height: 100vh;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Component, Vue } from "vue-property-decorator";
|
import { Component, Vue } from "vue-property-decorator";
|
||||||
|
import TopNav from "@/components/Navigation/TopNav.vue";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
components: {}
|
components: {
|
||||||
|
TopNav
|
||||||
|
}
|
||||||
})
|
})
|
||||||
export default class Lobby extends Vue {}
|
export default class Lobby extends Vue {}
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue