feat(ui): [UI7-1] 构建通用原子UI组件与业务Hooks

这个提交包含在:
2026-03-06 09:48:11 +08:00
父节点 9c48c8d3bc
当前提交 61180e2b3b
共修改 12 个文件,包含 356 行新增和 2 行删除
+5
查看文件
@@ -0,0 +1,5 @@
import { cn } from "../../lib/utils";
export function Skeleton({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {
return <div className={cn("animate-pulse rounded-md bg-slate-200", className)} {...props} />;
}
+14
查看文件
@@ -0,0 +1,14 @@
import { Toaster as SonnerToaster } from "sonner";
export function Toaster() {
return (
<SonnerToaster
position="top-right"
duration={3000}
toastOptions={{
className:
"border border-slate-200 bg-white text-slate-900 shadow-lg rounded-lg text-sm",
}}
/>
);
}
+36
查看文件
@@ -0,0 +1,36 @@
import { cn } from "../../lib/utils";
const sizeMap = {
sm: "h-4 w-4",
md: "h-6 w-6",
} as const;
export function Spinner({
size = "md",
className,
}: {
size?: "sm" | "md";
className?: string;
}) {
return (
<svg
className={cn("animate-spin text-slate-400", sizeMap[size], className)}
fill="none"
viewBox="0 0 24 24"
>
<circle
className="opacity-25"
cx="12"
cy="12"
r="10"
stroke="currentColor"
strokeWidth="4"
/>
<path
className="opacity-75"
fill="currentColor"
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
/>
</svg>
);
}