feat: replace loading spinners with skeletons
This commit is contained in:
@@ -1,22 +1,20 @@
|
||||
import { Button, Loader, Paper, Stack, Text, Title } from "@mantine/core";
|
||||
import { Button, Paper, Stack, Text, Title } from "@mantine/core";
|
||||
import type { FC, ReactNode } from "react";
|
||||
|
||||
type StateViewProps = {
|
||||
title: string;
|
||||
text: string;
|
||||
action?: ReactNode;
|
||||
loading?: boolean;
|
||||
error?: boolean;
|
||||
};
|
||||
|
||||
const StateView: FC<StateViewProps> = (props) => {
|
||||
const { title, text, action, loading = false, error = false } = props;
|
||||
const role = loading ? "status" : error ? "alert" : undefined;
|
||||
const { title, text, action, error = false } = props;
|
||||
const role = error ? "alert" : undefined;
|
||||
|
||||
return (
|
||||
<Paper p="xl" radius="md" shadow="xs" withBorder role={role}>
|
||||
<Stack align="flex-start" gap="sm">
|
||||
{loading ? <Loader aria-label={title} size="sm" /> : null}
|
||||
<Title order={2}>{title}</Title>
|
||||
<Text c="dimmed">{text}</Text>
|
||||
{action}
|
||||
|
||||
Reference in New Issue
Block a user