style: 核心股页面 formatGain 符号一致 + 表格 a11y 增强

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Sakurasan
2026-08-10 20:56:38 +08:00
co-authored by Claude
parent 5e7f0c4f13
commit a7cff0930d
+6 -6
View File
@@ -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>