basic custom Skeleton component for Character, Character page breadcrumbs

This commit is contained in:
Xevion
2020-09-05 18:44:14 -05:00
parent 68a28c693d
commit b5a3499ef1
2 changed files with 89 additions and 2 deletions

View File

@@ -1,18 +1,66 @@
<template>
<div>
<b-breadcrumb :items="breadcrumbs"></b-breadcrumb>
<b-card>
<h4>{{ this.$route.params.character }}</h4>
<h4 v-if="character">{{ this.$route.params.character }}</h4>
<Skeleton v-else style="max-width: 30%;"></Skeleton>
</b-card>
</div>
</template>
<style lang="scss" scoped>
.card-body h4 {
@import "../assets/scss/_variables";
.card-body h4, .breadcrumb-item.active {
text-transform: capitalize;
}
.skeleton {
min-height: 24px;
}
.breadcrumb-item + .breadcrumb-item::before {
color: $grey-10;
}
.breadcrumb {
background-color: $grey-3;
border-radius: 0;
.breadcrumb-item {
color: $grey-10;
}
}
</style>
<script>
import Skeleton from './Skeleton.vue';
export default {
data() {
return {
character: null,
};
},
components: {
Skeleton,
},
computed: {
breadcrumbs() {
return [
{
text: 'Home',
to: { name: 'Home' },
},
{
text: 'Characters',
to: { name: 'Home' },
},
{
text: this.character !== null ? this.character.name : this.$route.params.character,
active: true,
},
];
},
},
methods: {},
};
</script>

View File

@@ -0,0 +1,39 @@
<template>
<div class="skeleton"></div>
</template>
<style lang="scss" scoped>
@import "../assets/scss/_variables";
.skeleton {
background-color: $grey-4;
background-image: linear-gradient(90deg, $grey-4, $grey-6, $grey-4);
animation: 1.5s ease-in-out 0s infinite normal none running SkeletonLoading;
width: 100%;
display: block;
line-height: 1;
background-size: 200px 100%;
background-repeat: no-repeat;
border-radius: 3px;
}
@-webkit-keyframes SkeletonLoading {
0% {
background-position: -200px 0;
}
100% {
background-position: calc(200px + 100%) 0;
}
}
@keyframes SkeletonLoading {
0% {
background-position: -200px 0;
}
100% {
background-position: calc(200px + 100%) 0;
}
}
span {
font-size: 24px;
}
</style>