Spaces:
Sleeping
Sleeping
File size: 1,906 Bytes
43a06dc |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
<script lang="ts">
import type { Optional } from "$lib/types/generic";
export let width: Optional<string> = undefined;
export let height: Optional<string> = undefined;
export let hidden: Optional<boolean> = undefined;
let _class = '';
export { _class as class };
$: style = [
width && `width: ${width}`,
height && `height: ${height}`
].filter(a => a).join(';');
</script>
{#if hidden !== true}
<div
class="skeleton {_class}"
{style}
{...$$restProps}
></div>
{/if}
<style>
.skeleton {
border-radius: calc(var(--border-radius) / 2);
background-color: var(--button);
background-image: var(--skeleton-gradient);
background-size: 200px 100%;
background-repeat: no-repeat;
display: inline-flex;
justify-content: center;
align-items: center;
animation: skeleton 1.2s ease-in-out infinite;
line-height: 1;
font-size: 1em;
text-align: center;
pointer-events: none;
}
:global([data-theme=light]) .skeleton {
background-color: var(--button-hover);
}
.skeleton.elevated {
background-image: var(--skeleton-gradient-elevated);
background-color: var(--button-elevated);
}
:global([data-reduce-motion="true"]) .skeleton {
background-image: none;
}
.skeleton.big {
border-radius: var(--border-radius);
background-size: 400px 100%;
animation: skeleton-big 1.2s ease-in-out infinite;
}
@keyframes skeleton {
0% {
background-position: -200px 0;
}
100% {
background-position: calc(200px + 100%) 0;
}
}
@keyframes skeleton-big {
0% {
background-position: -400px 0;
}
100% {
background-position: calc(400px + 100%) 0;
}
}
</style> |