UNPKG

@datalayer/core

Version:
22 lines (21 loc) 782 B
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime"; /* * Copyright (c) 2023-2025 Datalayer, Inc. * Distributed under the terms of the Modified BSD License. */ import { Suspense } from "react"; import { SkeletonBox } from "@primer/react/experimental"; const Loading = (props) => { const { skeleton } = props; return (skeleton ? _jsx(_Fragment, { children: _jsx(SkeletonBox, { height: "100px" }) }) : _jsx(_Fragment, {})); }; export const WithSuspense = (Component, preload = true, skeleton = false) => (props) => { if (preload) { Component.preload(); } return (_jsx(Suspense, { fallback: _jsx(Loading, { skeleton: skeleton }), children: _jsx(Component, { ...props }) })); }; export default WithSuspense;