import type { ReactNode } from "react"; import type { Loadable } from "@executor/react"; import { IconSpinner, IconEmpty } from "./icons"; export function LoadableBlock(props: { loadable: Loadable; loading?: string; children: (data: T) => ReactNode; }) { if (props.loadable.status === "loading") { return (
{props.loading ?? "Loading..."}
); } if (props.loadable.status === "error") { return (
{props.loadable.error.message}
); } return <>{props.children(props.loadable.data)}; } export function EmptyState(props: { title: string; description?: string; className?: string; }) { return (

{props.title}

{props.description && (

{props.description}

)}
); }