style: 核心股页面 formatGain 符号一致 + 表格 a11y 增强
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -10,7 +10,7 @@ export const Route = createFileRoute("/core-stocks")({
|
|||||||
/** 格式化涨幅,红涨绿跌 */
|
/** 格式化涨幅,红涨绿跌 */
|
||||||
function formatGain(v: number | null | undefined): string {
|
function formatGain(v: number | null | undefined): string {
|
||||||
if (v == null) return "·";
|
if (v == null) return "·";
|
||||||
const s = v > 0 ? `+${v.toFixed(2)}%` : `${v.toFixed(2)}%`;
|
const s = v >= 0 ? `+${v.toFixed(2)}%` : `${v.toFixed(2)}%`;
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ function CoreStocksPage() {
|
|||||||
<header className="sticky top-0 z-10 bg-background/95 backdrop-blur border-b">
|
<header className="sticky top-0 z-10 bg-background/95 backdrop-blur border-b">
|
||||||
<div className="max-w-5xl mx-auto px-4 h-12 flex items-center justify-between">
|
<div className="max-w-5xl mx-auto px-4 h-12 flex items-center justify-between">
|
||||||
<div className="flex items-center gap-3">
|
<div className="flex items-center gap-3">
|
||||||
<Link to="/hot-map" className="hover:opacity-70 transition-opacity">
|
<Link to="/hot-map" className="hover:opacity-70 transition-opacity" aria-label="返回">
|
||||||
<ArrowLeft className="h-5 w-5" />
|
<ArrowLeft className="h-5 w-5" />
|
||||||
</Link>
|
</Link>
|
||||||
<h1 className="text-base font-semibold">核心股追踪</h1>
|
<h1 className="text-base font-semibold">核心股追踪</h1>
|
||||||
@@ -53,7 +53,7 @@ function CoreStocksPage() {
|
|||||||
|
|
||||||
{isLoading ? (
|
{isLoading ? (
|
||||||
<div className="animate-pulse rounded-xl bg-muted h-32" />
|
<div className="animate-pulse rounded-xl bg-muted h-32" />
|
||||||
) : dates.length === 0 ? (
|
) : dates.length === 0 || stocks.length === 0 ? (
|
||||||
<div className="text-center text-sm text-muted-foreground py-16">
|
<div className="text-center text-sm text-muted-foreground py-16">
|
||||||
暂无数据,数据将在每日收盘后自动采集
|
暂无数据,数据将在每日收盘后自动采集
|
||||||
</div>
|
</div>
|
||||||
@@ -62,13 +62,13 @@ function CoreStocksPage() {
|
|||||||
<table className="w-full text-sm">
|
<table className="w-full text-sm">
|
||||||
<thead>
|
<thead>
|
||||||
<tr className="border-b bg-muted/50">
|
<tr className="border-b bg-muted/50">
|
||||||
<th className="px-3 py-2 text-left font-medium whitespace-nowrap">股票</th>
|
<th scope="col" className="px-3 py-2 text-left font-medium whitespace-nowrap">股票</th>
|
||||||
{dates.map((d) => (
|
{dates.map((d) => (
|
||||||
<th key={d} className="px-2 py-2 text-right font-medium tabular-nums whitespace-nowrap">
|
<th key={d} scope="col" title={d} className="px-2 py-2 text-right font-medium tabular-nums whitespace-nowrap">
|
||||||
{d.slice(5)}
|
{d.slice(5)}
|
||||||
</th>
|
</th>
|
||||||
))}
|
))}
|
||||||
<th className="px-2 py-2 text-right font-medium">上榜</th>
|
<th scope="col" className="px-2 py-2 text-right font-medium">上榜</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|||||||
Reference in New Issue
Block a user