Files
caravel/frontend/src/components/ResourceState.tsx
T
2026-03-27 13:18:33 -07:00

24 lines
592 B
TypeScript

import { Show } from "solid-js"
import LoadingState from "@/components/LoadingState"
type ResourceStateProps = {
loading: boolean
error: unknown
loadingText: string
errorText: string
class?: string
}
export default function ResourceState(props: ResourceStateProps) {
return (
<>
<Show when={props.loading}>
<LoadingState message={props.loadingText} class={props.class} />
</Show>
<Show when={props.error && !props.loading}>
<p class={`text-center text-red-600 ${props.class ?? ""}`.trim()}>{props.errorText}</p>
</Show>
</>
)
}