调整
This commit is contained in:
1 parent
787544eec1
commit
4ff9146910
81 files changed
+18417
-545
No files matched your search
@@ -0,0 +1,64 @@
|
||||
---
|
||||
import type { Device } from '@/lib/schema';
|
||||
import { deviceTitle } from '@/lib/utils';
|
||||
|
||||
interface Props {
|
||||
device: Device;
|
||||
/** 紧凑模式:隐藏简介,用于首页等轻量列表 */
|
||||
compact?: boolean;
|
||||
}
|
||||
|
||||
const { device, compact = false } = Astro.props;
|
||||
const title = deviceTitle(device.brand, device.model);
|
||||
|
||||
const lifecycleText =
|
||||
device.lifecycle === 'discontinued' ? '已停产' : device.lifecycle === 'announced' ? '已发布' : '在售';
|
||||
|
||||
const stats = [
|
||||
{ label: 'SoC', value: device.specs.platform?.chipset ?? '—' },
|
||||
{ label: '屏幕', value: device.specs.display?.size ?? '—' },
|
||||
{ label: '电池', value: device.specs.battery?.capacity ?? '—' },
|
||||
{ label: '重量', value: device.specs.body?.weight ?? '—' },
|
||||
];
|
||||
---
|
||||
|
||||
<div class="relative">
|
||||
<a
|
||||
href={`/devices/${device.slug}`}
|
||||
class="group block rounded-lg border border-border bg-card p-5 transition-colors hover:border-primary/40 hover:bg-accent/20"
|
||||
>
|
||||
<div class="flex min-w-0 items-start">
|
||||
<span class="truncate text-base font-semibold leading-tight group-hover:text-primary">{title}</span>
|
||||
</div>
|
||||
|
||||
<dl class="tabular mt-4 grid grid-cols-2 gap-x-4 gap-y-1 text-xs">
|
||||
{
|
||||
stats.map((stat) => (
|
||||
<>
|
||||
<dt class="text-muted-foreground">{stat.label}</dt>
|
||||
<dd class="truncate text-right">{stat.value}</dd>
|
||||
</>
|
||||
))
|
||||
}
|
||||
</dl>
|
||||
|
||||
{!compact && device.summary && <p class="mt-4 line-clamp-2 pr-20 text-xs text-muted-foreground">{device.summary}</p>}
|
||||
|
||||
<div class="mt-3 flex h-7 items-center">
|
||||
<span class="rounded-full border border-border px-2 py-0.5 text-[11px] text-muted-foreground">
|
||||
{lifecycleText}
|
||||
</span>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
data-compare-toggle
|
||||
data-slug={device.slug}
|
||||
data-name={title}
|
||||
aria-pressed="false"
|
||||
class="compare-toggle absolute bottom-5 right-5 z-10 inline-flex h-7 items-center rounded-md border border-border bg-card px-2.5 text-[11px] text-muted-foreground transition-colors hover:border-primary/50 hover:text-foreground"
|
||||
>
|
||||
加入对比
|
||||
</button>
|
||||
</div>
|
||||
Reference in new issue
Block a user