polish(admin): 抽出后台控件包并统一各页布局与交互

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-16 19:03:21 +08:00
parent cfc6c1403b
commit f73d2a89e8
23 changed files with 1720 additions and 1412 deletions

View File

@@ -0,0 +1,58 @@
"use client";
import Link from "next/link";
import type { ReactNode } from "react";
type Tone = "default" | "accent" | "danger";
const toneClass: Record<Tone, string> = {
default: "",
accent: "is-accent",
danger: "is-danger",
};
/** 32px 圆形行内操作;hover/focus 走 CSS,禁止 JS 改 style */
export default function AdminIconButton({
children,
tip,
ariaLabel,
tone = "default",
className = "",
href,
disabled,
onClick,
type = "button",
}: {
children: ReactNode;
tip?: string;
ariaLabel: string;
tone?: Tone;
className?: string;
href?: string;
disabled?: boolean;
onClick?: () => void;
type?: "button" | "submit";
}) {
const cls = `admin-icon-btn ${toneClass[tone]} ${className}`.trim();
if (href && !disabled) {
return (
<Link href={href} className={cls} aria-label={ariaLabel} data-tip={tip}>
{children}
</Link>
);
}
return (
<button
type={type}
className={cls}
aria-label={ariaLabel}
data-tip={tip}
disabled={disabled}
onClick={onClick}
>
{children}
</button>
);
}