2022-07-18 22:42:56 +00:00
|
|
|
import { ReactNode, Suspense } from "react"
|
2022-07-19 18:06:26 +00:00
|
|
|
import { LoadingInline, LoadingMain } from "./renderers"
|
2022-07-18 22:42:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
export type LoadingBoundaryProps = {
|
|
|
|
text?: string,
|
|
|
|
children: ReactNode,
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-07-19 18:06:26 +00:00
|
|
|
export function LoadingBoundaryMain({ text, children }: LoadingBoundaryProps) {
|
2022-07-18 22:42:56 +00:00
|
|
|
return (
|
|
|
|
<Suspense fallback={<LoadingMain text={text} />}>
|
|
|
|
{children}
|
|
|
|
</Suspense>
|
|
|
|
)
|
2022-07-19 18:06:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export function LoadingBoundaryInline({ text, children }: LoadingBoundaryProps) {
|
|
|
|
return (
|
|
|
|
<Suspense fallback={<LoadingInline text={text} />}>
|
|
|
|
{children}
|
|
|
|
</Suspense>
|
|
|
|
)
|
|
|
|
}
|