|
@@ -1,5 +1,5 @@
|
|
|
import type { ReactNode } from "react";
|
|
import type { ReactNode } from "react";
|
|
|
-import { FileSearch, FileWarning, LoaderCircle, RotateCw } from "lucide-react";
|
|
|
|
|
|
|
+import { FileSearch, LoaderCircle, RotateCw } from "lucide-react";
|
|
|
import "./table-state.css";
|
|
import "./table-state.css";
|
|
|
|
|
|
|
|
export type TableStateProps = {
|
|
export type TableStateProps = {
|
|
@@ -11,9 +11,11 @@ export type TableStateProps = {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
export function TableState({ kind = "empty", children, details, onRetry, busy }: TableStateProps) {
|
|
export function TableState({ kind = "empty", children, details, onRetry, busy }: TableStateProps) {
|
|
|
- const Icon = kind === "error" ? FileWarning : kind === "loading" ? LoaderCircle : FileSearch;
|
|
|
|
|
|
|
+ const Icon = kind === "loading" ? LoaderCircle : FileSearch;
|
|
|
return <div className="table-feedback" data-kind={kind}>
|
|
return <div className="table-feedback" data-kind={kind}>
|
|
|
- <span className="table-feedback-art" aria-hidden="true"><Icon size={28} strokeWidth={1.5} /></span>
|
|
|
|
|
|
|
+ {kind === "error"
|
|
|
|
|
+ ? <img className="table-feedback-illustration" src="/images/table-load-error.webp" alt="" width={168} height={112} />
|
|
|
|
|
+ : <span className="table-feedback-art" aria-hidden="true"><Icon size={28} strokeWidth={1.5} /></span>}
|
|
|
<div className="table-feedback-copy" role={kind === "error" ? "alert" : "status"}>{children}</div>
|
|
<div className="table-feedback-copy" role={kind === "error" ? "alert" : "status"}>{children}</div>
|
|
|
{onRetry && <button type="button" className="table-feedback-retry" disabled={busy} onClick={onRetry}>
|
|
{onRetry && <button type="button" className="table-feedback-retry" disabled={busy} onClick={onRetry}>
|
|
|
<RotateCw size={14} aria-hidden="true" />{busy ? "正在重试…" : "重新加载"}
|
|
<RotateCw size={14} aria-hidden="true" />{busy ? "正在重试…" : "重新加载"}
|