feat(web): 前端共享基础(focusRing/proseBody/text-2xs + useBodyScrollLock + Toast撤销 + error/not-found/loading路由边界)
This commit is contained in:
37
apps/web/app/error.tsx
Normal file
37
apps/web/app/error.tsx
Normal file
@@ -0,0 +1,37 @@
|
||||
"use client";
|
||||
|
||||
import Link from "next/link";
|
||||
import { TriangleAlert } from "lucide-react";
|
||||
|
||||
import { EmptyState } from "@/components/ui/EmptyState";
|
||||
import { Button } from "@/components/ui/Button";
|
||||
import { buttonClass } from "@/lib/ui/variants";
|
||||
|
||||
interface ErrorBoundaryProps {
|
||||
error: Error & { digest?: string };
|
||||
reset: () => void;
|
||||
}
|
||||
|
||||
export default function Error({ reset }: ErrorBoundaryProps) {
|
||||
return (
|
||||
<main className="flex min-h-screen items-center justify-center bg-bg px-6 py-16">
|
||||
<div className="w-full max-w-md">
|
||||
<EmptyState
|
||||
icon={TriangleAlert}
|
||||
title="出错了"
|
||||
description="刚才的操作没能完成。可以重试,或先回到作品库。"
|
||||
action={
|
||||
<div className="flex items-center justify-center gap-2">
|
||||
<Button variant="primary" onClick={reset}>
|
||||
重试
|
||||
</Button>
|
||||
<Link href="/" className={buttonClass({ variant: "secondary" })}>
|
||||
返回作品库
|
||||
</Link>
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user