Skip to content

Commit

Permalink
- Move fork me banner to component
Browse files Browse the repository at this point in the history
- remove it from game page
  • Loading branch information
MrTimeey committed Feb 20, 2021
1 parent b607982 commit 5b4437e
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 22 deletions.
14 changes: 0 additions & 14 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
<template>
<v-app id="app">
<Ribbon id="ribbon"
v-bind="ribbonOptions"
></Ribbon>
<router-view></router-view>
</v-app>
</template>
Expand All @@ -11,17 +8,6 @@
export default {
name: 'App',
components: {
},
data: () => ({
ribbonOptions: {
text: 'Fork me on GitHub',
linkUrl: 'https://github.com/MrTimeey/vue-sudoku',
fixed: true,
left: true,
bottom: true,
}
})
}
</script>

Expand Down
24 changes: 24 additions & 0 deletions src/components/ForkMeBanner.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<template>
<Ribbon id="ribbon"
v-bind="ribbonOptions"
></Ribbon>
</template>

<script>
export default {
name: "ForkMeBanner",
data: () => ({
ribbonOptions: {
text: 'Fork me on GitHub',
linkUrl: 'https://github.com/MrTimeey/vue-sudoku',
fixed: true,
left: true,
bottom: true,
}
})
}
</script>

<style scoped>
</style>
18 changes: 10 additions & 8 deletions src/views/StartPage.vue
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
<template>
<div class="game-container">
<game-icon class="sudoku-icon"/>
<b-button @click="startGame(0)">Easy</b-button>
<b-button @click="startGame(1)">Medium</b-button>
<b-button @click="startGame(2)">Hard</b-button>
</div>
<div class="game-container">
<fork-me-banner/>
<game-icon class="sudoku-icon"/>
<b-button @click="startGame(0)">Easy</b-button>
<b-button @click="startGame(1)">Medium</b-button>
<b-button @click="startGame(2)">Hard</b-button>
</div>
</template>

<script>
import GameIcon from "@/components/GameIcon";
import BButton from "@/components/base/BButton";
import ForkMeBanner from "@/components/ForkMeBanner";
export default {
name: "StartPage",
components: {BButton, GameIcon},
components: {ForkMeBanner, BButton, GameIcon},
methods: {
async startGame(level) {
this.$store.commit('setLoading', true);
await this.$store.dispatch('game/initGame');
this.$store.commit('game/startGame', level);
this.$store.commit('setLoading', false);
await this.$router.push({name:'GamePage'});
await this.$router.push({name: 'GamePage'});
}
}
}
Expand Down

0 comments on commit 5b4437e

Please sign in to comment.