UNPKG

@navinc/base-react-components

Version:
35 lines (32 loc) 1.73 kB
var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; }; import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { CDNAsset } from './cdn-asset.js'; import { LoadingDots } from './loading-dots.js'; import { addClassNameTo } from './add-classname-to.js'; const GoldenCenter = addClassNameTo('div', /* cn */ 'flex items-center justify-center h-[calc(100vh * 1 / var(--golden-ratio))]'); const LoadingContent = addClassNameTo('div', /* cn */ 'flex flex-col flex-nowrap items-center justify-center'); /** # LoadingView This can be used to add a generic loading view with some basic layout styles. ``` <LoadingView message="Hello world"/> ``` */ export const LoadingView = (_a) => { var { className, message = null, illustration } = _a, props = __rest(_a, ["className", "message", "illustration"]); const defaultDirectory = 'illustrations'; return (_jsx(GoldenCenter, Object.assign({ className: className, "data-testid": "loading-view" }, props, { children: _jsxs(LoadingContent, { children: [message, _jsx(LoadingDots, { className: "text-primary mt-300" }), illustration ? _jsx(CDNAsset, { className: "h-[190px]", directory: defaultDirectory, filename: illustration }) : null] }) }))); }; LoadingView.displayName = 'LoadingView'; //# sourceMappingURL=loading-view.js.map