组件化代码
This commit is contained in:
61
web/src/lib/components/album/AlbumCard.svelte
Normal file
61
web/src/lib/components/album/AlbumCard.svelte
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
<script>
|
||||||
|
import { resolve } from '$app/paths';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} AlbumCardProps
|
||||||
|
* @property {import('$lib/api/types').Album} album
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @type {AlbumCardProps} */
|
||||||
|
let { album } = $props();
|
||||||
|
|
||||||
|
function formatDate(dateString) {
|
||||||
|
return new Date(dateString).toLocaleDateString();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<a href={resolve(`/album/${album.id}`)} class="album-card">
|
||||||
|
<div class="album-icon">📁</div>
|
||||||
|
<h3 class="album-name">{album.name}</h3>
|
||||||
|
<p class="album-date">{formatDate(album.createdAt)}</p>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.album-card {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
padding: 2rem;
|
||||||
|
background: #f9fafb;
|
||||||
|
border-radius: 12px;
|
||||||
|
text-decoration: none;
|
||||||
|
color: inherit;
|
||||||
|
transition:
|
||||||
|
transform 0.2s,
|
||||||
|
box-shadow 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.album-card:hover {
|
||||||
|
transform: translateY(-4px);
|
||||||
|
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.album-icon {
|
||||||
|
font-size: 4rem;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.album-name {
|
||||||
|
font-size: 1.125rem;
|
||||||
|
font-weight: 600;
|
||||||
|
margin: 0 0 0.5rem 0;
|
||||||
|
color: #1a1a1a;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.album-date {
|
||||||
|
font-size: 0.875rem;
|
||||||
|
color: #6b7280;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
30
web/src/lib/components/album/AlbumList.svelte
Normal file
30
web/src/lib/components/album/AlbumList.svelte
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<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: 1.5rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
2
web/src/lib/components/album/index.js
Normal file
2
web/src/lib/components/album/index.js
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
export { default as AlbumCard } from './AlbumCard.svelte';
|
||||||
|
export { default as AlbumList } from './AlbumList.svelte';
|
||||||
11
web/src/lib/components/index.js
Normal file
11
web/src/lib/components/index.js
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
// UI Components
|
||||||
|
export * from './ui/index.js';
|
||||||
|
|
||||||
|
// Layout Components
|
||||||
|
export * from './layout/index.js';
|
||||||
|
|
||||||
|
// Album Components
|
||||||
|
export * from './album/index.js';
|
||||||
|
|
||||||
|
// Photo Components
|
||||||
|
export * from './photo/index.js';
|
||||||
51
web/src/lib/components/layout/BackLink.svelte
Normal file
51
web/src/lib/components/layout/BackLink.svelte
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
<script>
|
||||||
|
/**
|
||||||
|
* @typedef {Object} BackLinkProps
|
||||||
|
* @property {string} href
|
||||||
|
* @property {string} [text]
|
||||||
|
* @property {import('svelte').Snippet} [children]
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @type {BackLinkProps} */
|
||||||
|
let { href, text = '返回', children } = $props();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<!-- eslint-disable-next-line svelte/no-navigation-without-resolve -->
|
||||||
|
<a {href} class="back-link">
|
||||||
|
<span class="back-icon">←</span>
|
||||||
|
{#if children}
|
||||||
|
{@render children()}
|
||||||
|
{:else}
|
||||||
|
<span class="back-text">{text}</span>
|
||||||
|
{/if}
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.back-link {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.5rem;
|
||||||
|
color: #3b82f6;
|
||||||
|
text-decoration: none;
|
||||||
|
font-size: 1rem;
|
||||||
|
padding: 0.5rem 0.75rem;
|
||||||
|
background: rgba(59, 130, 246, 0.1);
|
||||||
|
border-radius: 6px;
|
||||||
|
transition: all 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.back-link:hover {
|
||||||
|
background: rgba(59, 130, 246, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.back-icon {
|
||||||
|
font-size: 1.25rem;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 640px) {
|
||||||
|
.back-text {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
74
web/src/lib/components/layout/PageHeader.svelte
Normal file
74
web/src/lib/components/layout/PageHeader.svelte
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
<script>
|
||||||
|
/**
|
||||||
|
* @typedef {Object} PageHeaderProps
|
||||||
|
* @property {string} title
|
||||||
|
* @property {string} [subtitle]
|
||||||
|
* @property {import('svelte').Snippet} [children]
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @type {PageHeaderProps} */
|
||||||
|
let { title, subtitle, children } = $props();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<header class="page-header">
|
||||||
|
<div class="header-content">
|
||||||
|
<h1 class="header-title">{title}</h1>
|
||||||
|
{#if subtitle}
|
||||||
|
<p class="header-subtitle">{subtitle}</p>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
{#if children}
|
||||||
|
<div class="header-actions">
|
||||||
|
{@render children()}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.page-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: flex-start;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 1rem;
|
||||||
|
flex-shrink: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-content {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-title {
|
||||||
|
font-size: 2rem;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #1a1a1a;
|
||||||
|
margin: 0 0 0.5rem 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-subtitle {
|
||||||
|
font-size: 1rem;
|
||||||
|
color: #6b7280;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-actions {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.75rem;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 640px) {
|
||||||
|
.page-header {
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: stretch;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-actions {
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
2
web/src/lib/components/layout/index.js
Normal file
2
web/src/lib/components/layout/index.js
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
export { default as BackLink } from './BackLink.svelte';
|
||||||
|
export { default as PageHeader } from './PageHeader.svelte';
|
||||||
117
web/src/lib/components/photo/PhotoCard.svelte
Normal file
117
web/src/lib/components/photo/PhotoCard.svelte
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
<script>
|
||||||
|
import { resolve } from '$app/paths';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} PhotoCardProps
|
||||||
|
* @property {import('$lib/api/types').Photo} photo
|
||||||
|
* @property {(photoId: number, previewSrc: string) => void} [onUpgradeQuality]
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @type {PhotoCardProps} */
|
||||||
|
let { photo, onUpgradeQuality } = $props();
|
||||||
|
|
||||||
|
const previewSrc = `/api/v1/photo/${photo.id}/preview`;
|
||||||
|
|
||||||
|
function handleMouseEnter() {
|
||||||
|
if (onUpgradeQuality) {
|
||||||
|
onUpgradeQuality(photo.id, previewSrc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleFocus() {
|
||||||
|
if (onUpgradeQuality) {
|
||||||
|
onUpgradeQuality(photo.id, previewSrc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<a href={resolve(`/photo/${photo.id}`)} class="photo-card">
|
||||||
|
<div class="photo-wrapper">
|
||||||
|
{#if photo.mimeType?.startsWith('video/')}
|
||||||
|
<div class="video-indicator">🎬</div>
|
||||||
|
<div class="photo-placeholder">
|
||||||
|
<span>{photo.fileName}</span>
|
||||||
|
</div>
|
||||||
|
{:else}
|
||||||
|
<img
|
||||||
|
src={`${previewSrc}?w=800`}
|
||||||
|
srcset={`${previewSrc}?w=600 600w, ${previewSrc}?w=800 800w`}
|
||||||
|
sizes="(max-width: 768px) 150px, (max-width: 1200px) 200px, 250px"
|
||||||
|
alt={photo.fileName}
|
||||||
|
loading="lazy"
|
||||||
|
decoding="async"
|
||||||
|
class="photo-image"
|
||||||
|
onmouseenter={handleMouseEnter}
|
||||||
|
onfocus={handleFocus}
|
||||||
|
data-photo-id={photo.id}
|
||||||
|
/>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
<p class="photo-name">{photo.fileName}</p>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.photo-card {
|
||||||
|
display: block;
|
||||||
|
text-decoration: none;
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
.photo-wrapper {
|
||||||
|
position: relative;
|
||||||
|
aspect-ratio: 1;
|
||||||
|
background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
|
||||||
|
border-radius: 8px;
|
||||||
|
overflow: hidden;
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.photo-wrapper img {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
object-fit: cover;
|
||||||
|
transition: transform 0.3s ease;
|
||||||
|
background: #e5e7eb;
|
||||||
|
}
|
||||||
|
|
||||||
|
.photo-card:hover .photo-wrapper img {
|
||||||
|
transform: scale(1.08);
|
||||||
|
}
|
||||||
|
|
||||||
|
.photo-placeholder {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
color: #6b7280;
|
||||||
|
font-size: 0.875rem;
|
||||||
|
padding: 1rem;
|
||||||
|
text-align: center;
|
||||||
|
word-break: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
|
.video-indicator {
|
||||||
|
position: absolute;
|
||||||
|
top: 0.5rem;
|
||||||
|
right: 0.5rem;
|
||||||
|
background: rgba(0, 0, 0, 0.75);
|
||||||
|
color: white;
|
||||||
|
padding: 0.35rem 0.6rem;
|
||||||
|
border-radius: 6px;
|
||||||
|
font-size: 0.875rem;
|
||||||
|
z-index: 1;
|
||||||
|
backdrop-filter: blur(4px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.photo-name {
|
||||||
|
font-size: 0.875rem;
|
||||||
|
color: #374151;
|
||||||
|
margin: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
padding: 0 0.25rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
119
web/src/lib/components/photo/PhotoGrid.svelte
Normal file
119
web/src/lib/components/photo/PhotoGrid.svelte
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
<script>
|
||||||
|
import PhotoCard from './PhotoCard.svelte';
|
||||||
|
import { Empty, Loading } from '$lib/components/ui';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} PhotoGridProps
|
||||||
|
* @property {import('$lib/api/types').Photo[]} photos
|
||||||
|
* @property {boolean} [isLoading]
|
||||||
|
* @property {boolean} [hasMore]
|
||||||
|
* @property {number} [displayedCount]
|
||||||
|
* @property {number} [totalPhotos]
|
||||||
|
* @property {(photoId: number, previewSrc: string) => void} [onUpgradeQuality]
|
||||||
|
* @property {HTMLDivElement | null} [scrollContainer]
|
||||||
|
* @property {HTMLDivElement | null} [loadMoreTrigger]
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @type {PhotoGridProps} */
|
||||||
|
let {
|
||||||
|
photos,
|
||||||
|
isLoading = false,
|
||||||
|
hasMore = false,
|
||||||
|
displayedCount = 0,
|
||||||
|
totalPhotos = 0,
|
||||||
|
onUpgradeQuality,
|
||||||
|
scrollContainer = $bindable(null),
|
||||||
|
loadMoreTrigger = $bindable(null)
|
||||||
|
} = $props();
|
||||||
|
|
||||||
|
function getVisiblePhotos() {
|
||||||
|
return photos.slice(0, displayedCount);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#if photos.length === 0 && !hasMore}
|
||||||
|
<Empty message="暂无照片" icon="📷" />
|
||||||
|
{:else}
|
||||||
|
<div class="photo-scroll-container" bind:this={scrollContainer}>
|
||||||
|
<div class="photo-grid">
|
||||||
|
{#each getVisiblePhotos() as photo (photo.id)}
|
||||||
|
<PhotoCard {photo} {onUpgradeQuality} />
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{#if isLoading}
|
||||||
|
<div class="loading-trigger">
|
||||||
|
<Loading message="加载中..." size="small" />
|
||||||
|
</div>
|
||||||
|
{:else if displayedCount < photos.length || hasMore}
|
||||||
|
<div class="load-more-trigger" bind:this={loadMoreTrigger}>
|
||||||
|
<div class="loading-more">加载中...</div>
|
||||||
|
</div>
|
||||||
|
{:else if photos.length > 0}
|
||||||
|
<div class="load-complete">
|
||||||
|
✓ 已加载全部 {totalPhotos || photos.length} 张照片
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.photo-scroll-container {
|
||||||
|
flex: 1;
|
||||||
|
overflow-y: auto;
|
||||||
|
overflow-x: hidden;
|
||||||
|
scroll-behavior: smooth;
|
||||||
|
min-height: 400px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.photo-scroll-container::-webkit-scrollbar {
|
||||||
|
width: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.photo-scroll-container::-webkit-scrollbar-track {
|
||||||
|
background: #f1f1f1;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.photo-scroll-container::-webkit-scrollbar-thumb {
|
||||||
|
background: #c1c1c1;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.photo-scroll-container::-webkit-scrollbar-thumb:hover {
|
||||||
|
background: #a1a1a1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.photo-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
|
||||||
|
gap: 1rem;
|
||||||
|
padding-bottom: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 768px) {
|
||||||
|
.photo-grid {
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.load-more-trigger,
|
||||||
|
.loading-trigger {
|
||||||
|
text-align: center;
|
||||||
|
padding: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-more {
|
||||||
|
display: inline-block;
|
||||||
|
color: #6b7280;
|
||||||
|
font-size: 0.95rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.load-complete {
|
||||||
|
text-align: center;
|
||||||
|
padding: 2rem;
|
||||||
|
color: #10b981;
|
||||||
|
font-size: 0.875rem;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
2
web/src/lib/components/photo/index.js
Normal file
2
web/src/lib/components/photo/index.js
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
export { default as PhotoCard } from './PhotoCard.svelte';
|
||||||
|
export { default as PhotoGrid } from './PhotoGrid.svelte';
|
||||||
98
web/src/lib/components/ui/Button.svelte
Normal file
98
web/src/lib/components/ui/Button.svelte
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
<script>
|
||||||
|
/**
|
||||||
|
* @typedef {Object} ButtonProps
|
||||||
|
* @property {'button' | 'submit' | 'reset'} [type]
|
||||||
|
* @property {'primary' | 'secondary' | 'ghost' | 'danger'} [variant]
|
||||||
|
* @property {'small' | 'medium' | 'large'} [size]
|
||||||
|
* @property {boolean} [disabled]
|
||||||
|
* @property {() => void} [onclick]
|
||||||
|
* @property {import('svelte').Snippet} children
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @type {ButtonProps} */
|
||||||
|
let {
|
||||||
|
type = 'button',
|
||||||
|
variant = 'primary',
|
||||||
|
size = 'medium',
|
||||||
|
disabled = false,
|
||||||
|
onclick,
|
||||||
|
children
|
||||||
|
} = $props();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<button {type} {disabled} class="btn btn-{variant} btn-{size}" {onclick}>
|
||||||
|
{@render children()}
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.btn {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
border: none;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-weight: 500;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.2s;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn:disabled {
|
||||||
|
opacity: 0.5;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Variants */
|
||||||
|
.btn-primary {
|
||||||
|
background: #3b82f6;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary:hover:not(:disabled) {
|
||||||
|
background: #2563eb;
|
||||||
|
transform: translateY(-1px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-secondary {
|
||||||
|
background: #f3f4f6;
|
||||||
|
color: #374151;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-secondary:hover:not(:disabled) {
|
||||||
|
background: #e5e7eb;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-ghost {
|
||||||
|
background: transparent;
|
||||||
|
color: #3b82f6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-ghost:hover:not(:disabled) {
|
||||||
|
background: rgba(59, 130, 246, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-danger {
|
||||||
|
background: #ef4444;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-danger:hover:not(:disabled) {
|
||||||
|
background: #dc2626;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Sizes */
|
||||||
|
.btn-small {
|
||||||
|
padding: 0.5rem 1rem;
|
||||||
|
font-size: 0.875rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-medium {
|
||||||
|
padding: 0.625rem 1.25rem;
|
||||||
|
font-size: 0.95rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-large {
|
||||||
|
padding: 0.75rem 1.5rem;
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
56
web/src/lib/components/ui/Card.svelte
Normal file
56
web/src/lib/components/ui/Card.svelte
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
<script>
|
||||||
|
/**
|
||||||
|
* @typedef {Object} CardProps
|
||||||
|
* @property {'default' | 'interactive' | 'elevated'} [variant]
|
||||||
|
* @property {string} [href]
|
||||||
|
* @property {import('svelte').Snippet} children
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @type {CardProps} */
|
||||||
|
let { variant = 'default', href, children } = $props();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#if href}
|
||||||
|
<!-- eslint-disable-next-line svelte/no-navigation-without-resolve -->
|
||||||
|
<a {href} class="card card-{variant}">
|
||||||
|
{@render children()}
|
||||||
|
</a>
|
||||||
|
{:else}
|
||||||
|
<div class="card card-{variant}">
|
||||||
|
{@render children()}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.card {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
background: #f9fafb;
|
||||||
|
border-radius: 12px;
|
||||||
|
overflow: hidden;
|
||||||
|
transition: all 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-default {
|
||||||
|
padding: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-interactive {
|
||||||
|
padding: 2rem;
|
||||||
|
text-decoration: none;
|
||||||
|
color: inherit;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-interactive:hover {
|
||||||
|
transform: translateY(-4px);
|
||||||
|
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-elevated {
|
||||||
|
padding: 1.5rem;
|
||||||
|
box-shadow:
|
||||||
|
0 4px 6px -1px rgba(0, 0, 0, 0.1),
|
||||||
|
0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
39
web/src/lib/components/ui/Container.svelte
Normal file
39
web/src/lib/components/ui/Container.svelte
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
<script>
|
||||||
|
/**
|
||||||
|
* @typedef {Object} ContainerProps
|
||||||
|
* @property {'default' | 'wide' | 'narrow'} [size]
|
||||||
|
* @property {import('svelte').Snippet} children
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @type {ContainerProps} */
|
||||||
|
let { size = 'default', children } = $props();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="container container-{size}">
|
||||||
|
{@render children()}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.container {
|
||||||
|
width: 100%;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 2rem;
|
||||||
|
min-height: calc(100vh - 4rem);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
box-sizing: border-box;
|
||||||
|
overflow-x: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container-default {
|
||||||
|
max-width: 1200px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container-wide {
|
||||||
|
max-width: 1400px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container-narrow {
|
||||||
|
max-width: 800px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
48
web/src/lib/components/ui/Empty.svelte
Normal file
48
web/src/lib/components/ui/Empty.svelte
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
<script>
|
||||||
|
/**
|
||||||
|
* @typedef {Object} EmptyProps
|
||||||
|
* @property {string} [message]
|
||||||
|
* @property {string} [icon]
|
||||||
|
* @property {import('svelte').Snippet} [children]
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @type {EmptyProps} */
|
||||||
|
let { message = '暂无数据', icon = '📭', children } = $props();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="empty">
|
||||||
|
<div class="empty-icon">{icon}</div>
|
||||||
|
<p class="empty-message">{message}</p>
|
||||||
|
{#if children}
|
||||||
|
<div class="empty-action">
|
||||||
|
{@render children()}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.empty {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 4rem 2rem;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-icon {
|
||||||
|
font-size: 4rem;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-message {
|
||||||
|
color: #666;
|
||||||
|
font-size: 1.125rem;
|
||||||
|
margin: 0 0 1.5rem 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-action {
|
||||||
|
margin-top: 0.5rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
31
web/src/lib/components/ui/Grid.svelte
Normal file
31
web/src/lib/components/ui/Grid.svelte
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
<script>
|
||||||
|
/**
|
||||||
|
* @typedef {Object} GridProps
|
||||||
|
* @property {'auto' | 'fixed'} [type]
|
||||||
|
* @property {string} [minItemWidth]
|
||||||
|
* @property {string} [gap]
|
||||||
|
* @property {import('svelte').Snippet} children
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @type {GridProps} */
|
||||||
|
let { type = 'auto', minItemWidth = '200px', gap = '1.5rem', children } = $props();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="grid grid-{type}" style="--min-item-width: {minItemWidth}; --gap: {gap};">
|
||||||
|
{@render children()}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.grid {
|
||||||
|
display: grid;
|
||||||
|
gap: var(--gap, 1.5rem);
|
||||||
|
}
|
||||||
|
|
||||||
|
.grid-auto {
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(var(--min-item-width, 200px), 1fr));
|
||||||
|
}
|
||||||
|
|
||||||
|
.grid-fixed {
|
||||||
|
grid-template-columns: repeat(var(--columns, 3), 1fr);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
71
web/src/lib/components/ui/Loading.svelte
Normal file
71
web/src/lib/components/ui/Loading.svelte
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
<script>
|
||||||
|
/**
|
||||||
|
* @typedef {Object} LoadingProps
|
||||||
|
* @property {string} [message]
|
||||||
|
* @property {'small' | 'medium' | 'large'} [size]
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @type {LoadingProps} */
|
||||||
|
let { message = '加载中...', size = 'medium' } = $props();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="loading loading-{size}">
|
||||||
|
<div class="spinner"></div>
|
||||||
|
{#if message}
|
||||||
|
<p class="loading-message">{message}</p>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.loading {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-small {
|
||||||
|
padding: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-large {
|
||||||
|
padding: 4rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.spinner {
|
||||||
|
border: 3px solid rgba(0, 0, 0, 0.1);
|
||||||
|
border-top-color: #3b82f6;
|
||||||
|
border-radius: 50%;
|
||||||
|
animation: spin 1s linear infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-small .spinner {
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
border-width: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-medium .spinner {
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-large .spinner {
|
||||||
|
width: 56px;
|
||||||
|
height: 56px;
|
||||||
|
border-width: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-message {
|
||||||
|
margin-top: 1rem;
|
||||||
|
color: #6b7280;
|
||||||
|
font-size: 0.95rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes spin {
|
||||||
|
to {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
6
web/src/lib/components/ui/index.js
Normal file
6
web/src/lib/components/ui/index.js
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
export { default as Button } from './Button.svelte';
|
||||||
|
export { default as Card } from './Card.svelte';
|
||||||
|
export { default as Container } from './Container.svelte';
|
||||||
|
export { default as Grid } from './Grid.svelte';
|
||||||
|
export { default as Empty } from './Empty.svelte';
|
||||||
|
export { default as Loading } from './Loading.svelte';
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<script>
|
<script>
|
||||||
import { albums, no_albums } from '$lib/paraglide/messages';
|
import { albums } from '$lib/paraglide/messages';
|
||||||
import { resolve } from '$app/paths';
|
import { Container, PageHeader, AlbumList } from '$lib/components';
|
||||||
|
|
||||||
let { data } = $props();
|
let { data } = $props();
|
||||||
|
|
||||||
@@ -12,91 +12,7 @@
|
|||||||
<title>{albums()}</title>
|
<title>{albums()}</title>
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
<div class="container">
|
<Container>
|
||||||
<header class="header">
|
<PageHeader title={albums()} />
|
||||||
<h1>{albums()}</h1>
|
<AlbumList albums={albums_list} />
|
||||||
</header>
|
</Container>
|
||||||
|
|
||||||
{#if albums_list.length === 0}
|
|
||||||
<div class="empty">{no_albums()}</div>
|
|
||||||
{:else}
|
|
||||||
<div class="album-grid">
|
|
||||||
{#each albums_list as album (album.id)}
|
|
||||||
<a href={resolve(`/album/${album.id}`)} class="album-card">
|
|
||||||
<div class="album-icon">📁</div>
|
|
||||||
<h3 class="album-name">{album.name}</h3>
|
|
||||||
<p class="album-date">
|
|
||||||
{new Date(album.createdAt).toLocaleDateString()}
|
|
||||||
</p>
|
|
||||||
</a>
|
|
||||||
{/each}
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
.container {
|
|
||||||
max-width: 1200px;
|
|
||||||
margin: 0 auto;
|
|
||||||
padding: 2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header {
|
|
||||||
margin-bottom: 2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header h1 {
|
|
||||||
font-size: 2rem;
|
|
||||||
font-weight: 700;
|
|
||||||
color: #1a1a1a;
|
|
||||||
}
|
|
||||||
|
|
||||||
.empty {
|
|
||||||
text-align: center;
|
|
||||||
padding: 4rem 2rem;
|
|
||||||
color: #666;
|
|
||||||
}
|
|
||||||
|
|
||||||
.album-grid {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
|
|
||||||
gap: 1.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.album-card {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
padding: 2rem;
|
|
||||||
background: #f9fafb;
|
|
||||||
border-radius: 12px;
|
|
||||||
text-decoration: none;
|
|
||||||
color: inherit;
|
|
||||||
transition:
|
|
||||||
transform 0.2s,
|
|
||||||
box-shadow 0.2s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.album-card:hover {
|
|
||||||
transform: translateY(-4px);
|
|
||||||
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.album-icon {
|
|
||||||
font-size: 4rem;
|
|
||||||
margin-bottom: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.album-name {
|
|
||||||
font-size: 1.125rem;
|
|
||||||
font-weight: 600;
|
|
||||||
margin: 0 0 0.5rem 0;
|
|
||||||
color: #1a1a1a;
|
|
||||||
}
|
|
||||||
|
|
||||||
.album-date {
|
|
||||||
font-size: 0.875rem;
|
|
||||||
color: #6b7280;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
import { albums, back, photo_count, loading } from '$lib/paraglide/messages';
|
import { albums, back, photo_count, loading } from '$lib/paraglide/messages';
|
||||||
import { resolve } from '$app/paths';
|
import { resolve } from '$app/paths';
|
||||||
import { SvelteSet } from 'svelte/reactivity';
|
import { SvelteSet } from 'svelte/reactivity';
|
||||||
|
import { Container, PageHeader, BackLink, PhotoGrid, Empty } from '$lib/components';
|
||||||
|
|
||||||
let { data } = $props();
|
let { data } = $props();
|
||||||
|
|
||||||
@@ -104,10 +105,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getVisiblePhotos() {
|
|
||||||
return allPhotos.slice(0, displayedCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 当用户悬停或聚焦图片时,升级图片质量
|
* 当用户悬停或聚焦图片时,升级图片质量
|
||||||
* @param {number} photoId
|
* @param {number} photoId
|
||||||
@@ -127,7 +124,7 @@
|
|||||||
|
|
||||||
// 找到对应的 img 元素并更新 srcset
|
// 找到对应的 img 元素并更新 srcset
|
||||||
const imgElement = document.querySelector(`img[data-photo-id="${photoId}"]`);
|
const imgElement = document.querySelector(`img[data-photo-id="${photoId}"]`);
|
||||||
if (imgElement && !imgElement.dataset.upgraded) {
|
if (imgElement && imgElement instanceof HTMLImageElement && !imgElement.dataset.upgraded) {
|
||||||
imgElement.dataset.upgraded = 'true';
|
imgElement.dataset.upgraded = 'true';
|
||||||
imgElement.srcset = `${previewSrc}?w=1000 1000w, ${previewSrc}?w=1200 1200w`;
|
imgElement.srcset = `${previewSrc}?w=1000 1000w, ${previewSrc}?w=1200 1200w`;
|
||||||
imgElement.sizes = '(max-width: 768px) 150px, (max-width: 1200px) 200px, 300px';
|
imgElement.sizes = '(max-width: 768px) 150px, (max-width: 1200px) 200px, 300px';
|
||||||
@@ -141,250 +138,26 @@
|
|||||||
<title>{album ? `${album.name} - ${albums()}` : loading()}</title>
|
<title>{album ? `${album.name} - ${albums()}` : loading()}</title>
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
<div class="container">
|
<Container size="wide">
|
||||||
<header class="header">
|
<PageHeader
|
||||||
<a href={resolve('/')} class="back-link">← {back()}</a>
|
title={album?.name || loading()}
|
||||||
{#if album}
|
subtitle={album ? photo_count({ count: data.totalPhotos || allPhotos.length }) : undefined}
|
||||||
<h1>{album.name}</h1>
|
>
|
||||||
<p class="photo-count">
|
<BackLink href={resolve('/')} text={back()} />
|
||||||
{photo_count({ count: data.totalPhotos || allPhotos.length })}
|
</PageHeader>
|
||||||
</p>
|
|
||||||
{/if}
|
|
||||||
</header>
|
|
||||||
|
|
||||||
{#if !album || (allPhotos.length === 0 && !hasMore)}
|
{#if !album || (allPhotos.length === 0 && !hasMore)}
|
||||||
<div class="empty">暂无照片</div>
|
<Empty message="暂无照片" icon="📷" />
|
||||||
{:else}
|
{:else}
|
||||||
<div class="photo-scroll-container" bind:this={scrollContainer}>
|
<PhotoGrid
|
||||||
<div class="photo-grid">
|
photos={allPhotos}
|
||||||
{#each getVisiblePhotos() as photo (photo.id)}
|
{isLoading}
|
||||||
<a href={resolve(`/photo/${photo.id}`)} class="photo-card">
|
{hasMore}
|
||||||
<div class="photo-wrapper">
|
{displayedCount}
|
||||||
{#if photo.mimeType?.startsWith('video/')}
|
totalPhotos={data.totalPhotos || allPhotos.length}
|
||||||
<div class="video-indicator">🎬</div>
|
onUpgradeQuality={upgradePhotoQuality}
|
||||||
<div class="photo-placeholder">
|
bind:scrollContainer
|
||||||
<span>{photo.fileName}</span>
|
bind:loadMoreTrigger
|
||||||
</div>
|
/>
|
||||||
{:else}
|
|
||||||
{@const photoId = photo.id}
|
|
||||||
{@const previewSrc = `/api/v1/photo/${photoId}/preview`}
|
|
||||||
<img
|
|
||||||
src={`${previewSrc}?w=800`}
|
|
||||||
srcset={`${previewSrc}?w=600 600w, ${previewSrc}?w=800 800w`}
|
|
||||||
sizes="(max-width: 768px) 150px, (max-width: 1200px) 200px, 250px"
|
|
||||||
alt={photo.fileName}
|
|
||||||
loading="lazy"
|
|
||||||
decoding="async"
|
|
||||||
class="photo-image"
|
|
||||||
onmouseenter={() => upgradePhotoQuality(photoId, previewSrc)}
|
|
||||||
onfocus={() => upgradePhotoQuality(photoId, previewSrc)}
|
|
||||||
data-photo-id={photo.id}
|
|
||||||
/>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
<p class="photo-name">{photo.fileName}</p>
|
|
||||||
</a>
|
|
||||||
{/each}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{#if isLoading}
|
|
||||||
<div class="loading-trigger">
|
|
||||||
<div class="loading-spinner">{loading()}</div>
|
|
||||||
</div>
|
|
||||||
{:else if displayedCount < allPhotos.length || hasMore}
|
|
||||||
<div class="load-more-trigger" bind:this={loadMoreTrigger}>
|
|
||||||
<div class="loading-more">{loading()}...</div>
|
|
||||||
</div>
|
|
||||||
{:else if allPhotos.length > 0}
|
|
||||||
<div class="load-complete">
|
|
||||||
✓ 已加载全部 {allPhotos.length} 张照片
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</Container>
|
||||||
|
|
||||||
<style>
|
|
||||||
.container {
|
|
||||||
max-width: 1400px;
|
|
||||||
margin: 0 auto;
|
|
||||||
padding: 2rem;
|
|
||||||
min-height: calc(100vh - 4rem);
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header {
|
|
||||||
margin-bottom: 1rem;
|
|
||||||
flex-shrink: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.back-link {
|
|
||||||
display: inline-block;
|
|
||||||
margin-bottom: 1rem;
|
|
||||||
color: #3b82f6;
|
|
||||||
text-decoration: none;
|
|
||||||
font-size: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.back-link:hover {
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header h1 {
|
|
||||||
font-size: 2rem;
|
|
||||||
font-weight: 700;
|
|
||||||
color: #1a1a1a;
|
|
||||||
margin: 0 0 0.5rem 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.photo-count {
|
|
||||||
font-size: 1rem;
|
|
||||||
color: #6b7280;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.empty {
|
|
||||||
text-align: center;
|
|
||||||
padding: 4rem 2rem;
|
|
||||||
color: #666;
|
|
||||||
font-size: 1.125rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.photo-scroll-container {
|
|
||||||
flex: 1;
|
|
||||||
overflow-y: auto;
|
|
||||||
scroll-behavior: smooth;
|
|
||||||
min-height: 400px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.photo-scroll-container::-webkit-scrollbar {
|
|
||||||
width: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.photo-scroll-container::-webkit-scrollbar-track {
|
|
||||||
background: #f1f1f1;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.photo-scroll-container::-webkit-scrollbar-thumb {
|
|
||||||
background: #c1c1c1;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.photo-scroll-container::-webkit-scrollbar-thumb:hover {
|
|
||||||
background: #a1a1a1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.photo-grid {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
|
|
||||||
gap: 1rem;
|
|
||||||
padding-bottom: 2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (min-width: 768px) {
|
|
||||||
.photo-grid {
|
|
||||||
grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.photo-card {
|
|
||||||
display: block;
|
|
||||||
text-decoration: none;
|
|
||||||
color: inherit;
|
|
||||||
}
|
|
||||||
|
|
||||||
.photo-wrapper {
|
|
||||||
position: relative;
|
|
||||||
aspect-ratio: 1;
|
|
||||||
background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
|
|
||||||
border-radius: 8px;
|
|
||||||
overflow: hidden;
|
|
||||||
margin-bottom: 0.5rem;
|
|
||||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.photo-wrapper img {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
object-fit: cover;
|
|
||||||
transition: transform 0.3s ease;
|
|
||||||
background: #e5e7eb;
|
|
||||||
}
|
|
||||||
|
|
||||||
.photo-card:hover .photo-wrapper img {
|
|
||||||
transform: scale(1.08);
|
|
||||||
}
|
|
||||||
|
|
||||||
.photo-placeholder {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
color: #6b7280;
|
|
||||||
font-size: 0.875rem;
|
|
||||||
padding: 1rem;
|
|
||||||
text-align: center;
|
|
||||||
word-break: break-word;
|
|
||||||
}
|
|
||||||
|
|
||||||
.video-indicator {
|
|
||||||
position: absolute;
|
|
||||||
top: 0.5rem;
|
|
||||||
right: 0.5rem;
|
|
||||||
background: rgba(0, 0, 0, 0.75);
|
|
||||||
color: white;
|
|
||||||
padding: 0.35rem 0.6rem;
|
|
||||||
border-radius: 6px;
|
|
||||||
font-size: 0.875rem;
|
|
||||||
z-index: 1;
|
|
||||||
backdrop-filter: blur(4px);
|
|
||||||
}
|
|
||||||
|
|
||||||
.photo-name {
|
|
||||||
font-size: 0.875rem;
|
|
||||||
color: #374151;
|
|
||||||
margin: 0;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
white-space: nowrap;
|
|
||||||
padding: 0 0.25rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.load-more-trigger,
|
|
||||||
.loading-trigger {
|
|
||||||
text-align: center;
|
|
||||||
padding: 2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.loading-more,
|
|
||||||
.loading-spinner {
|
|
||||||
display: inline-block;
|
|
||||||
color: #6b7280;
|
|
||||||
font-size: 0.95rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.loading-spinner {
|
|
||||||
animation: pulse 1.5s ease-in-out infinite;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes pulse {
|
|
||||||
0%,
|
|
||||||
100% {
|
|
||||||
opacity: 0.5;
|
|
||||||
}
|
|
||||||
50% {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.load-complete {
|
|
||||||
text-align: center;
|
|
||||||
padding: 2rem;
|
|
||||||
color: #10b981;
|
|
||||||
font-size: 0.875rem;
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|||||||
Reference in New Issue
Block a user