Merge branch 'develop' into main
This commit is contained in:
@@ -70,6 +70,15 @@ hr {
|
|||||||
border-color: rgba($white, .2);
|
border-color: rgba($white, .2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.fs-icon {
|
||||||
|
width: 50px;
|
||||||
|
height: 50px;
|
||||||
|
&.icon-sm {
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.btn {
|
.btn {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding: 13px 33px;
|
padding: 13px 33px;
|
||||||
@@ -119,11 +128,28 @@ hr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.fs-icon {
|
.bg-image {
|
||||||
width: 50px;
|
position: relative;
|
||||||
height: 50px;
|
&:after {
|
||||||
&.icon-sm {
|
display: block;
|
||||||
width: 20px;
|
content: "";
|
||||||
height: 20px;
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
background-size: cover;
|
||||||
|
background-attachment: fixed;
|
||||||
|
z-index: -1;
|
||||||
|
opacity: 33%;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
&.bg-fade-in {
|
||||||
|
&:after {
|
||||||
|
width: 120vw;
|
||||||
|
opacity: 0;
|
||||||
|
animation: fadeInBg 2s ease-out 0s 1 forwards,
|
||||||
|
paneBgAround 35s ease-in-out 0s infinite forwards;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
84
src/components/NestLoader.vue
Normal file
84
src/components/NestLoader.vue
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
<template>
|
||||||
|
<div class="fs-loader-wrapper">
|
||||||
|
<div class="fs-loader"></div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import { defineComponent } from "vue";
|
||||||
|
|
||||||
|
export default defineComponent({
|
||||||
|
name: "nest-loader"
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.fs-loader-wrapper {
|
||||||
|
padding: 100px 0;
|
||||||
|
.fs-loader {
|
||||||
|
display: block;
|
||||||
|
position: relative;
|
||||||
|
height: 100px;
|
||||||
|
width: 100px;
|
||||||
|
margin: -25px auto 0 auto;
|
||||||
|
border: 2px solid transparent;
|
||||||
|
border-top-color: $white;
|
||||||
|
border-radius: 50%;
|
||||||
|
-webkit-animation: spin7 1.5s ease infinite;
|
||||||
|
animation: spin7 1.5s ease infinite;
|
||||||
|
|
||||||
|
&:before {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
top: 14px;
|
||||||
|
right: 14px;
|
||||||
|
bottom: 14px;
|
||||||
|
left: 14px;
|
||||||
|
border: 2px solid transparent;
|
||||||
|
border-radius: 50%;
|
||||||
|
border-top-color: $white;
|
||||||
|
-webkit-animation: spin7 3s linear infinite;
|
||||||
|
animation: spin7 3s linear infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:after {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
top: 30px;
|
||||||
|
right: 30px;
|
||||||
|
bottom: 30px;
|
||||||
|
left: 30px;
|
||||||
|
border: 2px solid transparent;
|
||||||
|
border-radius: 50%;
|
||||||
|
border-top-color: $white;
|
||||||
|
-webkit-animation: spin7 1.5s ease infinite;
|
||||||
|
animation: spin7 1.5s ease infinite;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@-webkit-keyframes spin7 {
|
||||||
|
from {
|
||||||
|
-webkit-transform: rotate(0deg);
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
-webkit-transform: rotate(359deg);
|
||||||
|
transform: rotate(359deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@keyframes spin7 {
|
||||||
|
from {
|
||||||
|
-webkit-transform: rotate(0deg);
|
||||||
|
transform: rotate(0deg);
|
||||||
|
-webkit-transform: rotate(0deg);
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
-webkit-transform: rotate(359deg);
|
||||||
|
transform: rotate(359deg);
|
||||||
|
-webkit-transform: rotate(359deg);
|
||||||
|
transform: rotate(359deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -16,11 +16,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent } from "vue";
|
import { defineComponent } from "vue";
|
||||||
|
|
||||||
// API
|
|
||||||
import axios from "axios";
|
|
||||||
// Global methods
|
|
||||||
import { addCelestialType } from "@/plugins/methods";
|
|
||||||
|
|
||||||
import CelestialCard from "@/components/celestials/CelestialCard.vue";
|
import CelestialCard from "@/components/celestials/CelestialCard.vue";
|
||||||
import CelestialFilters from "./CelestialFilters.vue";
|
import CelestialFilters from "./CelestialFilters.vue";
|
||||||
|
|
||||||
@@ -30,64 +25,39 @@ export default defineComponent({
|
|||||||
CelestialCard,
|
CelestialCard,
|
||||||
CelestialFilters
|
CelestialFilters
|
||||||
},
|
},
|
||||||
|
props: {
|
||||||
|
celestials: {
|
||||||
|
type: Array,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
// Initial state
|
// Initial state
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
celestials: Array<any>(),
|
|
||||||
activeFilter: "all"
|
activeFilter: "all"
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
sortedCelestials(): any {
|
sortedCelestials(): Array<any> {
|
||||||
if (this.activeFilter == "moons") {
|
if (this.activeFilter == "moons") {
|
||||||
return this.celestials.filter(e => e.type === "lune");
|
return this.celestials.filter((e: any) => e.type === "lune");
|
||||||
} else if (this.activeFilter == "planets") {
|
} else if (this.activeFilter == "planets") {
|
||||||
return this.celestials.filter(
|
return this.celestials.filter(
|
||||||
e => e.type === "planète" || e.type === "planète à lunes"
|
(e: any) => e.type === "planète" || e.type === "planète à lunes"
|
||||||
);
|
);
|
||||||
} else if (this.activeFilter == "stars") {
|
} else if (this.activeFilter == "stars") {
|
||||||
return this.celestials.filter(e => e.type === "étoile");
|
return this.celestials.filter((e: any) => e.type === "étoile");
|
||||||
} else if (this.activeFilter == "others") {
|
} else if (this.activeFilter == "others") {
|
||||||
return this.celestials.filter(e => e.type === "autre");
|
return this.celestials.filter((e: any) => e.type === "autre");
|
||||||
} else {
|
} else {
|
||||||
return this.celestials;
|
return this.celestials;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
|
||||||
// Fetches from API...
|
|
||||||
this.fetchCelestials().then(res => {
|
|
||||||
// ...and add type
|
|
||||||
this.celestials = this.addType(res);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
/**
|
|
||||||
* Fetches celestial bodies from API
|
|
||||||
*/
|
|
||||||
fetchCelestials(): Promise<any> {
|
|
||||||
return axios
|
|
||||||
.get("https://api.le-systeme-solaire.net/rest/bodies/")
|
|
||||||
.then(res => {
|
|
||||||
return res.data.bodies;
|
|
||||||
})
|
|
||||||
.catch(err => {
|
|
||||||
console.log(err);
|
|
||||||
return [];
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Assign a type from the celestial object provided
|
|
||||||
*/
|
|
||||||
addType(bodies: Array<any>): Array<any> {
|
|
||||||
return bodies.map((e: any) => addCelestialType(e));
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Applies the filter type to the data
|
* Applies the filter type to the data
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<section class="home">
|
<section class="home bg-image bg-fade-in">
|
||||||
<div class="splash fade-in-children">
|
<div class="splash fade-in-children">
|
||||||
<h2 class="heading-1">Full Skies</h2>
|
<h2 class="heading-1">Full Skies</h2>
|
||||||
<p class="heading-2">
|
<p class="heading-2">
|
||||||
@@ -31,20 +31,7 @@ export default defineComponent({
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
&:after {
|
&:after {
|
||||||
display: block;
|
|
||||||
content: "";
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
bottom: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 120vw;
|
|
||||||
background-image: url("/home_bg-min.jpg");
|
background-image: url("/home_bg-min.jpg");
|
||||||
background-size: cover;
|
|
||||||
z-index: -1;
|
|
||||||
opacity: 0;
|
|
||||||
pointer-events: none;
|
|
||||||
animation: fadeInBg 2s ease-out 0s 1 forwards,
|
|
||||||
paneBgAround 35s ease-in-out 0s infinite forwards;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,8 +1,17 @@
|
|||||||
<template>
|
<template>
|
||||||
<section class="celestial">
|
<section class="celestial bg-image">
|
||||||
<header>
|
<div v-if="loaded">
|
||||||
<h1 class="heading-1">{{ celestial.name }}</h1>
|
<header>
|
||||||
</header>
|
<h1 class="heading-1">{{ celestial.name }}</h1>
|
||||||
|
</header>
|
||||||
|
<div class="section-content">
|
||||||
|
<div v-if="error">Une erreur est survenue : {{ error }}</div>
|
||||||
|
<div>{{ celestial }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div v-else>
|
||||||
|
<nest-loader />
|
||||||
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -13,47 +22,67 @@ import { defineComponent } from "vue";
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
// Global methods
|
// Global methods
|
||||||
import { addCelestialType } from "@/plugins/methods";
|
import { addCelestialType } from "@/plugins/methods";
|
||||||
|
import NestLoader from "@/components/NestLoader.vue";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
|
components: {
|
||||||
|
NestLoader
|
||||||
|
},
|
||||||
name: "Celestial",
|
name: "Celestial",
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
celestial: {},
|
celestial: false,
|
||||||
|
loaded: false,
|
||||||
error: ""
|
error: ""
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
slug: {
|
slug: {
|
||||||
type: String,
|
type: String,
|
||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
// Fetches from API...
|
// Fetches from API...
|
||||||
this.fetchCelestial()
|
this.fetchCelestial()
|
||||||
.then(res => {
|
.then(res => {
|
||||||
// ...and add type
|
// Adds type after fake loading (it's just to showcase the spinner tbh)
|
||||||
this.celestial = addCelestialType(res);
|
setTimeout(() => {
|
||||||
|
this.celestial = addCelestialType(res);
|
||||||
|
this.loaded = true;
|
||||||
|
}, 1000);
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(() => {
|
||||||
this.error = err.message;
|
this.error = "Impossible de récupérer l'astre demandé.";
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
/**
|
/**
|
||||||
* Fetches celestial bodies from API
|
* Fetches celestial body from API
|
||||||
*/
|
*/
|
||||||
fetchCelestial(): Promise<any> {
|
fetchCelestial(): Promise<any> {
|
||||||
return axios
|
return axios
|
||||||
.get(`https://api.le-systeme-solaire.net/rest/bodies/${this.slug}`)
|
.get(`https://api.le-systeme-solaire.net/rest/bodies/${this.slug}`)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
return res.data;
|
return res.data;
|
||||||
})
|
|
||||||
.catch(err => {
|
|
||||||
this.error = err.message;
|
|
||||||
return [];
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.celestial {
|
||||||
|
position: relative;
|
||||||
|
min-height: 100%;
|
||||||
|
padding: 25px 5%;
|
||||||
|
|
||||||
|
&:after {
|
||||||
|
background-image: url("/celestials_bg-min.jpg");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -1,22 +1,71 @@
|
|||||||
<template>
|
<template>
|
||||||
<section class="celestials">
|
<section class="celestials bg-image">
|
||||||
<header>
|
<header>
|
||||||
<h1 class="heading-1">Le système solaire</h1>
|
<h1 class="heading-1">Le système solaire</h1>
|
||||||
</header>
|
</header>
|
||||||
<div class="section-content">
|
<div class="section-content">
|
||||||
<celestials-list />
|
<div v-if="error">Une erreur est survenue : {{ error }}</div>
|
||||||
|
<div v-if="celestials.length > 1">
|
||||||
|
<celestials-list :celestials="celestials" />
|
||||||
|
</div>
|
||||||
|
<div v-else>
|
||||||
|
<nest-loader />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent } from "vue";
|
import { defineComponent } from "vue";
|
||||||
|
|
||||||
|
// API
|
||||||
|
import axios from "axios";
|
||||||
|
// Global methods
|
||||||
|
import { addCelestialType } from "@/plugins/methods";
|
||||||
|
|
||||||
import CelestialsList from "@/components/celestials/CelestialsList.vue";
|
import CelestialsList from "@/components/celestials/CelestialsList.vue";
|
||||||
|
import NestLoader from "@/components/NestLoader.vue";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "Celestials",
|
name: "Celestials",
|
||||||
components: {
|
components: {
|
||||||
CelestialsList
|
CelestialsList,
|
||||||
|
NestLoader
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
celestials: Array<any>(),
|
||||||
|
error: ""
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
this.fetchCelestials()
|
||||||
|
.then(res => {
|
||||||
|
this.celestials = this.addType(res);
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.error = "Impossible de récupérer les astres.";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
/**
|
||||||
|
* Fetches celestial bodies from API
|
||||||
|
*/
|
||||||
|
fetchCelestials(): Promise<any> {
|
||||||
|
return axios
|
||||||
|
.get("https://api.le-systeme-solaire.net/rest/bodies/")
|
||||||
|
.then(res => {
|
||||||
|
return res.data.bodies;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* Assign a type from the celestial object provided
|
||||||
|
*/
|
||||||
|
addType(bodies: Array<any>): Array<any> {
|
||||||
|
return bodies.map((e: any) => addCelestialType(e));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@@ -28,19 +77,7 @@ export default defineComponent({
|
|||||||
padding: 25px 5%;
|
padding: 25px 5%;
|
||||||
|
|
||||||
&:after {
|
&:after {
|
||||||
display: block;
|
|
||||||
content: "";
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
bottom: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
background-image: url("/celestials_bg-min.jpg");
|
background-image: url("/celestials_bg-min.jpg");
|
||||||
background-size: cover;
|
|
||||||
background-attachment: fixed;
|
|
||||||
z-index: -1;
|
|
||||||
opacity: 33%;
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user