Empty state is now component on both pages
This commit is contained in:
parent
2c3cd548ac
commit
94642bac3a
4 changed files with 55 additions and 12 deletions
31
src/components/Empty.vue
Normal file
31
src/components/Empty.vue
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
<template>
|
||||||
|
<div class="empty text-center">
|
||||||
|
<h1>
|
||||||
|
{{title}}
|
||||||
|
</h1>
|
||||||
|
<p>
|
||||||
|
<slot>
|
||||||
|
This page is empty.
|
||||||
|
</slot>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data () {
|
||||||
|
return {}
|
||||||
|
},
|
||||||
|
props: [
|
||||||
|
'title'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="stylus">
|
||||||
|
.empty
|
||||||
|
height: 100%
|
||||||
|
background-image: url('/statics/wand.svg')
|
||||||
|
background-repeat: no-repeat
|
||||||
|
background-position: top center
|
||||||
|
</style>
|
|
@ -1,16 +1,25 @@
|
||||||
<template>
|
<template>
|
||||||
<main>
|
<main>
|
||||||
<spell-list
|
<spell-list
|
||||||
|
v-if="state.spells.data.length"
|
||||||
:spells="state.spells.data"
|
:spells="state.spells.data"
|
||||||
></spell-list>
|
></spell-list>
|
||||||
|
<page-empty
|
||||||
|
v-else
|
||||||
|
title="Writing Spellbook..."
|
||||||
|
>
|
||||||
|
Please wait...
|
||||||
|
</page-empty>
|
||||||
</main>
|
</main>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
|
import Empty from './Empty'
|
||||||
import SpellList from './Spelllist'
|
import SpellList from './Spelllist'
|
||||||
import { state } from '../store'
|
import { state } from '../store'
|
||||||
|
|
||||||
|
Vue.component('page-empty', Empty)
|
||||||
Vue.component('spell-list', SpellList)
|
Vue.component('spell-list', SpellList)
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -19,3 +28,8 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="stylus">
|
||||||
|
main
|
||||||
|
height: 90%
|
||||||
|
</style>
|
||||||
|
|
|
@ -4,25 +4,23 @@
|
||||||
v-if="mySpells.length"
|
v-if="mySpells.length"
|
||||||
:spells="mySpells"
|
:spells="mySpells"
|
||||||
></spell-list>
|
></spell-list>
|
||||||
<div
|
<page-empty
|
||||||
class="empty text-center"
|
|
||||||
v-else
|
v-else
|
||||||
|
title="You haven't chosen any spells"
|
||||||
>
|
>
|
||||||
<h1>
|
Try <i>bookmark</i> bookmarking spells from the
|
||||||
You haven't chosen any spells
|
<router-link to="/">all spells page</router-link> to add to your spellbook.
|
||||||
</h1>
|
</page-empty>
|
||||||
<p>
|
|
||||||
You must <i>bookmark</i> bookmark spells from the <router-link to="/">All Spells</router-link> page.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</main>
|
</main>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
|
import Empty from './Empty'
|
||||||
import SpellList from './Spelllist'
|
import SpellList from './Spelllist'
|
||||||
import { state } from '../store'
|
import { state } from '../store'
|
||||||
|
|
||||||
|
Vue.component('page-empty', Empty)
|
||||||
Vue.component('spell-list', SpellList)
|
Vue.component('spell-list', SpellList)
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -48,7 +46,4 @@ export default {
|
||||||
<style scoped lang="stylus">
|
<style scoped lang="stylus">
|
||||||
main
|
main
|
||||||
height: 90%
|
height: 90%
|
||||||
background-image: url('/statics/wand.svg')
|
|
||||||
background-repeat: no-repeat
|
|
||||||
background-position: top center
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -76,6 +76,9 @@ export default {
|
||||||
data () {
|
data () {
|
||||||
return { state }
|
return { state }
|
||||||
},
|
},
|
||||||
|
mounted () {
|
||||||
|
state.lastSpell = this.state.spell.data.name
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
spell () {
|
spell () {
|
||||||
return this.state.spells.data.find(spell => spell.name === this.$route.params.name)
|
return this.state.spells.data.find(spell => spell.name === this.$route.params.name)
|
||||||
|
|
Loading…
Add table
Reference in a new issue