immich/web/src/lib/elements/Skeleton.svelte
midzelis 0ebf75a96f feat: search results page (without keyboard actions)
fix: missing responsive calculation in UserPageLayout
2025-10-07 01:29:52 +00:00

54 lines
1.3 KiB
Svelte

<script lang="ts">
interface Props {
height: number;
title?: string;
stylePaddingHorizontalPx?: number;
}
let { height = 0, title, stylePaddingHorizontalPx = 0 }: Props = $props();
</script>
<skeleton class="overflow-clip" style:height={height + 'px'}>
{#if title}
<div
class="flex pt-7 pb-5 h-6 place-items-center text-xs font-medium text-immich-fg bg-light dark:text-immich-dark-fg md:text-sm"
>
{title}
</div>
{/if}
<div
class="animate-pulse absolute h-full"
style:width="100%"
style:padding-left={stylePaddingHorizontalPx + 'px'}
style:padding-right={stylePaddingHorizontalPx + 'px'}
data-skeleton="true"
></div>
</skeleton>
<style>
[data-skeleton] {
background-image: url('/light_skeleton.png');
background-repeat: repeat;
background-size: 235px, 235px;
}
@media (max-width: 767px) {
[data-skeleton] {
background-size: 100px, 100px;
}
}
:global(.dark) [data-skeleton] {
background-image: url('/dark_skeleton.png');
}
@keyframes delayedVisibility {
to {
visibility: visible;
}
}
[data-skeleton] {
visibility: hidden;
animation:
0s linear 0.1s forwards delayedVisibility,
pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
</style>