feat(housekeeping): finish accessible command deck
This commit is contained in:
1 parent
85ad0452d3
commit
a113e48880
55 files changed
+17064
-509
No files matched your search
@@ -6,10 +6,21 @@ interface HousekeepingPageStateBaseProps {
|
||||
retryAction?: ReactNode;
|
||||
}
|
||||
|
||||
export type HousekeepingPageState =
|
||||
| "loading"
|
||||
| "empty"
|
||||
| "partial"
|
||||
| "error"
|
||||
| "forbidden"
|
||||
| "ready";
|
||||
|
||||
type HousekeepingPageStateProps = HousekeepingPageStateBaseProps &
|
||||
(
|
||||
| { state: "partial"; partialLabel: string }
|
||||
| { state: "loading" | "empty" | "error"; partialLabel?: never }
|
||||
| {
|
||||
state: Exclude<HousekeepingPageState, "partial">;
|
||||
partialLabel?: never;
|
||||
}
|
||||
);
|
||||
|
||||
export function HousekeepingPageState({
|
||||
@@ -19,13 +30,14 @@ export function HousekeepingPageState({
|
||||
description,
|
||||
retryAction,
|
||||
}: HousekeepingPageStateProps) {
|
||||
const isError = state === "error";
|
||||
const isError = state === "error" || state === "forbidden";
|
||||
const isPartial = state === "partial";
|
||||
|
||||
return (
|
||||
<section
|
||||
role={isError ? "alert" : "status"}
|
||||
aria-live={state === "loading" ? "polite" : undefined}
|
||||
aria-live={isError ? "assertive" : "polite"}
|
||||
data-page-state={state}
|
||||
className={`rounded-lg border p-4 ${
|
||||
isError
|
||||
? "border-[var(--admin-error)] bg-[var(--admin-surface)]"
|
||||
|
||||
Reference in new issue
Block a user