Files
loongyan/web/src/lib/components/album/AlbumList.svelte
2026-03-20 21:44:43 +08:00

31 lines
607 B
Svelte

<script>
import AlbumCard from './AlbumCard.svelte';
import { Empty } from '$lib/components/ui';
/**
* @typedef {Object} AlbumListProps
* @property {import('$lib/api/types').Album[]} albums
*/
/** @type {AlbumListProps} */
let { albums } = $props();
</script>
{#if albums.length === 0}
<Empty message="暂无相册" icon="📁" />
{:else}
<div class="album-grid">
{#each albums as album (album.id)}
<AlbumCard {album} />
{/each}
</div>
{/if}
<style>
.album-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
gap: var(--space-lg);
}
</style>