gamebrary/src/components/Placeholder.vue

95 lines
1.8 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;
2019-12-17 04:54:31 +00:00
grid-template-columns: var(--placeholder-image-width, 80px) auto;
2019-11-08 20:34:06 +00:00
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;
2019-12-17 04:54:31 +00:00
background: var(--placeholder-background, #e5e5e5);
background: linear-gradient(to right,
var(--placeholder-background, #e5e5e5) 8%,
var(--placeholder-accent, #fff) 18%,
var(--placeholder-background, #e5e5e5) 33%);
2019-11-08 20:34:06 +00:00
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;
border-radius: var(--border-radius) / 2;
2019-11-08 20:34:06 +00:00
}
2019-01-11 20:20:21 +00:00
2019-12-17 04:54:31 +00:00
.text {
margin: var(--placeholder-text-margin, 0);
}
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;
border-radius: var(--border-radius) / 2;
2019-11-08 20:34:06 +00:00
@extend .animated-background;
}
2019-01-11 20:20:21 +00:00
</style>