reorganize code into smaller files & dirs
This commit is contained in:
25
packages/app/src/Components/ErrorOrOffline.tsx
Normal file
25
packages/app/src/Components/ErrorOrOffline.tsx
Normal file
@ -0,0 +1,25 @@
|
||||
import { OfflineError } from "@snort/shared";
|
||||
import { Offline } from "./Offline";
|
||||
import classNames from "classnames";
|
||||
import Icon from "@/Components/Icons/Icon";
|
||||
|
||||
export function ErrorOrOffline({
|
||||
error,
|
||||
onRetry,
|
||||
className,
|
||||
}: {
|
||||
error: Error;
|
||||
onRetry?: () => void | Promise<void>;
|
||||
className?: string;
|
||||
}) {
|
||||
if (error instanceof OfflineError) {
|
||||
return <Offline onRetry={onRetry} className={className} />;
|
||||
} else {
|
||||
return (
|
||||
<div className={classNames("flex flex-row items-center px-4 py-3 gap-2", className)}>
|
||||
<Icon name="alert-circle" size={24} />
|
||||
<b>{error.message}</b>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user