Skip to content

Commit 60b84c1

Browse files
committed
卡片移动端显示优化
1 parent 03698d7 commit 60b84c1

2 files changed

Lines changed: 22 additions & 18 deletions

File tree

src/pages/index.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ const currentReading = bookshelfData.find((item: any) => item.status === 'readin
5353
<Icon name='book' class='size-6 text-purple-600 dark:text-purple-400' />
5454
</div>
5555
<div class='flex-1 min-w-0'>
56-
<div class='flex items-center justify-between mb-1'>
56+
<div class='flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 mb-1'>
5757
<div class='flex items-center gap-2'>
5858
<span class='text-sm text-muted-foreground'>最近在读</span>
59-
<span class='text-xs px-2 py-0.5 rounded-full bg-purple-100 dark:bg-purple-900 text-purple-600 dark:text-purple-400 font-medium'>
59+
<span class='text-xs px-1.5 py-0.5 sm:px-2 rounded-full bg-purple-100 dark:bg-purple-900 text-purple-600 dark:text-purple-400 font-medium whitespace-nowrap'>
6060
进行中
6161
</span>
6262
</div>

src/pages/shelf/index.astro

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -193,24 +193,28 @@ const getTagColor = (index: number) => {
193193
</div>
194194

195195
{/* 移动端显示状态和评分 */}
196-
<div class="flex items-center gap-2 sm:hidden">
197-
<div class={`flex items-center gap-1 rounded-md px-2 py-1 text-xs font-medium bg-${statusInfo.color}-100 text-${statusInfo.color}-800 dark:bg-${statusInfo.color}-900 dark:text-${statusInfo.color}-200`}>
198-
<Icon name={statusInfo.icon} class={`size-3.5`} />
199-
<span>
200-
{statusInfo.label}
201-
{item.progress !== undefined && ` / ${item.progress}%`}
202-
</span>
203-
</div>
204-
{item.rating && (
205-
<div class="flex items-center gap-1 rounded-md bg-muted px-2 py-1 text-xs font-medium">
206-
<Icon name="star" class="size-3.5 text-yellow-400" />
207-
<span>{item.rating.toFixed(1)}</span>
196+
<div class="flex flex-col gap-2 sm:hidden">
197+
<div class="flex items-center gap-2 flex-wrap">
198+
<div class={`flex items-center gap-1 rounded-md px-1.5 py-0.5 text-xs font-medium bg-${statusInfo.color}-100 text-${statusInfo.color}-800 dark:bg-${statusInfo.color}-900 dark:text-${statusInfo.color}-200 whitespace-nowrap`}>
199+
<Icon name={statusInfo.icon} class={`size-3.5`} />
200+
<span>
201+
{statusInfo.label}
202+
{item.progress !== undefined && ` / ${item.progress}%`}
203+
</span>
208204
</div>
209-
)}
205+
{item.rating && (
206+
<div class="flex items-center gap-1 rounded-md bg-muted px-1.5 py-0.5 text-xs font-medium whitespace-nowrap">
207+
<Icon name="star" class="size-3.5 text-yellow-400" />
208+
<span>{item.rating.toFixed(1)}</span>
209+
</div>
210+
)}
211+
</div>
210212
{item.identifier && (
211-
<div class="flex items-center gap-1 rounded-md bg-muted px-2 py-1 text-xs font-medium">
212-
<Icon name="hashtag" class="size-3.5" />
213-
<span class="text-xs">{item.identifier}</span>
213+
<div class="flex items-center gap-1">
214+
<div class="flex items-center gap-1 rounded-md bg-muted px-1.5 py-0.5 text-xs font-medium">
215+
<Icon name="hashtag" class="size-3.5" />
216+
<span class="text-xs">{item.identifier}</span>
217+
</div>
214218
</div>
215219
)}
216220
</div>

0 commit comments

Comments
 (0)