gamebrary/src/components/Placeholder.vue

77 lines
1.7 KiB
Vue
Raw Normal View History

2019-01-11 20:20:21 +00:00
<template lang="html">
2019-01-17 06:21:41 +00:00
<div
2019-10-09 16:30:07 +00:00
:class="['placeholder', { 'has-image': image && lines > 0 }]"
2019-01-17 06:21:41 +00:00
v-if="image || lines"
>
2019-01-11 20:20:21 +00:00
<div class="image" v-if="image" />
<div class="text" v-if="lines">
<div
class="text-line"
v-for="n in lines"
:key="n"
/>
</div>
</div>
</template>
<script>
export default {
2019-11-08 19:56:03 +00:00
props: {
image: Boolean,
large: Boolean,
lines: Number,
},
2019-01-11 20:20:21 +00:00
};
</script>
<style lang="scss" rel="stylesheet/scss" scoped>
2019-09-10 20:02:16 +00:00
@import "~styles/styles";
2019-01-11 20:20:21 +00:00
.placeholder {
max-width: 100%;
&.has-image {
display: grid;
grid-template-columns: 80px auto;
grid-gap: $gp;
}
}
// Animation
@keyframes placeholder{
0%{
background-position: -468px 0
}
100%{
background-position: 468px 0
}
}
.animated-background {
animation-duration: 1s;
animation-fill-mode: forwards;
animation-iteration-count: infinite;
animation-name: placeholder;
animation-timing-function: linear;
2019-10-09 16:30:07 +00:00
background: #e5e5e5;
background: linear-gradient(to right, #e5e5e5 8%, #fff 18%, #e5e5e5 33%);
2019-01-11 20:20:21 +00:00
background-size: 800px 104px;
height: 96px;
position: relative;
}
.image {
2019-01-17 06:21:41 +00:00
width: var(--placeholder-image-width, 80px);
height: var(--placeholder-image-height, 120px);
2019-01-11 20:20:21 +00:00
@extend .animated-background;
}
.text-line {
2019-01-17 06:21:41 +00:00
width: var(--placeholder-text-width, 100%);
height: var(--placeholder-text-height, 12px);
2019-01-11 20:20:21 +00:00
margin-bottom: $gp / 2;
@extend .animated-background;
}
</style>