gamebrary/src/components/Placeholder.vue

88 lines
1.6 KiB
Vue
Raw Normal View History

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