+ Added some more info on the _slug.vue template

This commit is contained in:
Alexis
2021-03-28 18:46:15 +02:00
parent 4da4f2f362
commit ddc36047fe

View File

@@ -3,14 +3,31 @@
<div v-if="celestialLoaded"> <div v-if="celestialLoaded">
<header> <header>
<h1 class="heading-1"> <h1 class="heading-1">
{{ celestial.name }} <span>{{ celestial.name }}</span>
<span v-if="celestial.name != celestial.englishName">/ {{ celestial.englishName }}</span>
<span class="txt-capitalize">- {{ celestial.type }}</span>
</h1> </h1>
</header> </header>
<div class="section-content"> <div class="section-content">
<div v-if="error"> <main class="celestial-body">
Une erreur est survenue : {{ error }} <div>
</div> <h3 class="heading-3">
<div>{{ celestial }}</div> Informations
</h3>
<p v-if="celestial.discoveredBy">
Découvert par {{ celestial.discoveredBy }} le {{ celestial.discoveryDate }}
</p>
<p>Facteur Gravité : {{ celestial.gravity }}</p>
<p>Facteur Densité : {{ celestial.density }}</p>
<p>Inclinaison : {{ celestial.inclination }}</p>
</div>
<div v-if="celestial.moons" class="celestial-moons">
<h2 class="heading-2">
Lunes orbitant {{ celestial.name }}
</h2>
<celestials-list :celestials="celestial.moons" :has-filters="false" />
</div>
</main>
</div> </div>
</div> </div>
<div v-else> <div v-else>
@@ -25,7 +42,6 @@ import { fetchCelestial } from '@/api/le-systeme-solaire'
// import { fetchWikipediaExcerpt } from "@/api/wikipedia"; // import { fetchWikipediaExcerpt } from "@/api/wikipedia";
// Global methods // Global methods
import { addCelestialType } from '@/plugins/methods'
import NestLoader from '@/components/NestLoader.vue' import NestLoader from '@/components/NestLoader.vue'
export default { export default {
@@ -47,16 +63,13 @@ export default {
// Fetches from API... // Fetches from API...
fetchCelestial(this.$route.params.slug) fetchCelestial(this.$route.params.slug)
.then((res) => { .then((res) => {
this.celestial = addCelestialType(res) this.celestial = res
this.celestialLoaded = true this.celestialLoaded = true
return this.celestial return this.celestial
}) })
.catch(() => { .catch(() => {
this.error = "Impossible de récupérer l'astre demandé." this.error = "Impossible de récupérer l'astre demandé."
}) })
.then(() => {
// fetchWikipediaExcerpt(celestial);
})
} }
} }
</script> </script>
@@ -70,5 +83,11 @@ export default {
&:after { &:after {
background-image: url("/celestials_bg-min.jpg"); background-image: url("/celestials_bg-min.jpg");
} }
.celestial-body {
.celestial-type {
text-transform: capitalize;
}
}
} }
</style> </style>