Do some refactoring

This commit is contained in:
Jon Staab
2026-02-27 13:23:41 -08:00
parent 5d102ad215
commit 247a5c0ec0
12 changed files with 153 additions and 88 deletions
+22
View File
@@ -0,0 +1,22 @@
import { Show } from "solid-js"
type ResourceStateProps = {
loading: boolean
error: unknown
loadingText: string
errorText: string
class?: string
}
export default function ResourceState(props: ResourceStateProps) {
return (
<>
<Show when={props.loading}>
<p class={`text-gray-500 ${props.class ?? ""}`.trim()}>{props.loadingText}</p>
</Show>
<Show when={props.error && !props.loading}>
<p class={`text-red-600 ${props.class ?? ""}`.trim()}>{props.errorText}</p>
</Show>
</>
)
}