Add ImageSkeleton component, improve breadcrumb skeleton scss, restructure Skeleton.vue

This commit is contained in:
Xevion
2022-05-21 17:16:14 -05:00
parent a2c55ed029
commit 25aa6cd2c9
3 changed files with 70 additions and 43 deletions

View File

@@ -38,19 +38,6 @@
</div> </div>
</template> </template>
<style lang="scss" scoped>
.breadcrumb-skeleton {
background-color: $grey-3;
height: 48px;
& > .card-body {
padding: 0 0 0 1em;
display: flex;
align-items: center;
}
}
</style>
<style lang="scss"> <style lang="scss">
.card-title { .card-title {
font-family: "Montserrat", sans-serif; font-family: "Montserrat", sans-serif;
@@ -127,7 +114,7 @@ export default {
this.fetch(); this.fetch();
}, },
methods: { methods: {
fetch() { async fetch() {
// Fetch the episode, then scroll - already fetched episode should scroll immediately // Fetch the episode, then scroll - already fetched episode should scroll immediately
this.$store.dispatch(types.FETCH_EPISODE, {season: this.params.season, episode: this.params.episode}) this.$store.dispatch(types.FETCH_EPISODE, {season: this.params.season, episode: this.params.episode})
.then(() => { .then(() => {

View File

@@ -0,0 +1,20 @@
<template>
<div class="image-skeleton" />
</template>
<script>
export default {
name: "ImageSkeleton"
}
</script>
<style lang="scss">
.image-skeleton {
width: 100%;
height: 100%;
background-color: $grey-4;
display: block;
border-radius: 3px;
}
</style>

View File

@@ -1,11 +1,34 @@
<template> <template>
<div class="outer-skeleton"> <div class="outer-skeleton">
<div class="skeleton" :class="[animated ? undefined : 'no-animate']" :style="[style, inner_style]" /> <div
class="skeleton"
:class="[animated ? undefined : 'no-animate']"
:style="[style, innerStyle]"
/>
</div> </div>
</template> </template>
<style lang="scss" scoped>
.skeleton { <style lang="scss">
.breadcrumb-skeleton {
height: 48px;
& > .card-body {
padding: 0 0 0 1em;
display: flex;
align-items: center;
}
}
.outer-skeleton {
padding: 0.35em 0.3em 0.35em 0.35em;
.breadcrumb-skeleton > {
display: inline-block;
}
.skeleton {
width: 100%; width: 100%;
height: 100%;
display: block; display: block;
line-height: 1; line-height: 1;
background-size: 200px 100%; background-size: 200px 100%;
@@ -18,10 +41,7 @@
&.no-animate { &.no-animate {
animation: none; animation: none;
} }
} }
.outer-skeleton {
padding: 0.2em 0;
} }
@-webkit-keyframes SkeletonLoading { @-webkit-keyframes SkeletonLoading {
@@ -33,7 +53,7 @@
} }
} }
@keyframes SkeletonLoa,ding { @keyframes SkeletonLoading {
0% { 0% {
background-position: -200px 0; background-position: -200px 0;
} }
@@ -41,19 +61,16 @@
background-position: calc(200px + 100%) 0; background-position: calc(200px + 100%) 0;
} }
} }
span {
font-size: 24px;
}
</style> </style>
<script> <script>
export default { export default {
props: { props: {
inner_style: { innerStyle: {
type: Object type: Object,
default: null,
}, },
inner_class: { innerClass: {
type: String, type: String,
default: '' default: ''
}, },
@@ -61,22 +78,25 @@ export default {
type: Boolean, type: Boolean,
default: true default: true
}, },
border_radius: { borderRadius: {
type: String, type: String,
default: ''
}, },
primary_color: { primaryColor: {
type: String, type: String,
default: '',
}, },
secondary_color: { secondaryColor: {
type: String, type: String,
default: '',
} }
}, },
computed: { computed: {
style() { style() {
return { return {
'--primary-color': this.primary_color, '--primary-color': this.primaryColor,
'--secondary-color': this.secondary_color, '--secondary-color': this.secondaryColor,
'--border-radius': this.border_radius '--border-radius': this.borderRadius
} }
} }
} }