change episode title format, add skeleton loaders & breadcrumbs component

This commit is contained in:
Xevion
2020-09-11 13:05:27 -05:00
parent e3f4123d89
commit 1d109a8ab1

View File

@@ -1,19 +1,23 @@
<template> <template>
<div> <div>
<b-card <b-breadcrumb :items="breadcrumbs"></b-breadcrumb>
:title="`Season ${this.$route.params.season} Episode ${ <b-card class="mb-4">
this.$route.params.episode <template v-if="episode !== null">
} \ <h3>"{{ episode.title }}"</h3>
- ${episode != null ? episode.title : ''}`" <span v-if="episode">
class="mb-4" {{ episode.description }}
> </span>
<span v-if="episode"> <CharacterList
{{ episode.description }} v-if="episode && episode.characters"
</span> :characters="episode.characters"
<CharacterList ></CharacterList>
v-if="episode && episode.characters" </template>
:characters="episode.characters" <template v-else>
></CharacterList> <Skeleton style="width: 30%;"></Skeleton>
<Skeleton style="width: 70%; height: 60%;"></Skeleton>
<Skeleton style="width: 45%; height: 60%;"></Skeleton>
<Skeleton style="width: 69%; height: 40%;"></Skeleton>
</template>
</b-card> </b-card>
<div v-if="episode != null"> <div v-if="episode != null">
<b-card <b-card
@@ -56,12 +60,14 @@
import axios from "axios"; import axios from "axios";
import QuoteList from "./QuoteList.vue"; import QuoteList from "./QuoteList.vue";
import CharacterList from "./CharacterList.vue"; import CharacterList from "./CharacterList.vue";
import Skeleton from './Skeleton.vue';
export default { export default {
name: "Episode", name: "Episode",
components: { components: {
QuoteList, QuoteList,
CharacterList, CharacterList,
Skeleton,
}, },
data() { data() {
return { return {
@@ -95,8 +101,39 @@ ${this.$route.params.season}/${this.$route.params.episode}/`;
}, },
watch: { watch: {
$route() { $route() {
this.getEpisode(); this.episode = null;
this.$nextTick(() => {
this.getEpisode();
})
}, },
}, },
computed: {
breadcrumbs() {
return [
{
text: 'Home',
to: {
name: 'Home'
}
},
{
text: `Season ${this.$route.params.season}`,
to: {
name: 'Season',
season: this.$route.params.season
}
},
{
text: `Episode ${this.$route.params.episode}`,
to: {
name: 'Episode',
season: this.$route.params.season,
episode: this.$route.params.episode
},
active: true
}
]
}
}
}; };
</script> </script>