Files
Checkmate/client/src/Components/design-elements/Fallback.tsx
T

85 lines
1.5 KiB
TypeScript
Raw Normal View History

2026-01-23 19:58:37 +00:00
import Stack from "@mui/material/Stack";
import { useTheme } from "@mui/material/styles";
import { LAYOUT } from "@/Utils/Theme/constants";
import { EmptyState } from "./EmptyState";
2026-01-23 19:58:37 +00:00
import type { StackProps } from "@mui/material/Stack";
interface BaseFallbackProps extends StackProps {
children: React.ReactNode;
}
export const BaseFallback = ({ children, ...props }: BaseFallbackProps) => {
const theme = useTheme();
return (
<Stack
alignItems="center"
justifyContent="center"
sx={{ width: "100%", py: theme.spacing(LAYOUT.LG) }}
2026-01-23 19:58:37 +00:00
{...props}
>
{children}
</Stack>
);
};
export const ErrorFallback = ({
title,
subtitle,
}: {
title: string;
subtitle: string;
}) => {
return (
<EmptyState
fullscreen
title={title}
description={subtitle}
/>
2026-01-23 19:58:37 +00:00
);
};
export const EmptyFallback = ({
title,
description,
2026-01-23 19:58:37 +00:00
actionButtonText,
actionLink,
}: {
title: string;
description?: string;
2026-01-23 19:58:37 +00:00
actionButtonText: string;
actionLink: string;
}) => {
return (
<EmptyState
fullscreen
title={title}
description={description}
actionText={actionButtonText}
actionTo={actionLink}
/>
2026-01-23 19:58:37 +00:00
);
};
export const EmptyMonitorFallback = ({
title,
description,
2026-01-23 19:58:37 +00:00
actionButtonText,
actionLink,
}: {
page: string;
title: string;
description?: string;
2026-01-23 19:58:37 +00:00
actionButtonText: string;
actionLink: string;
}) => {
return (
<EmptyState
fullscreen
title={title}
description={description}
actionText={actionButtonText}
actionTo={actionLink}
/>
2026-01-23 19:58:37 +00:00
);
};