UNPKG

@navinc/base-react-components

Version:
73 lines (71 loc) 3.54 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; 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; }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const jsx_runtime_1 = require("react/jsx-runtime"); const styled_components_1 = __importStar(require("styled-components")); const cdn_asset_js_1 = __importDefault(require("./cdn-asset.js")); const is_rebrand_js_1 = __importDefault(require("./is-rebrand.js")); const loading_dots_js_1 = __importDefault(require("./loading-dots.js")); const GoldenCenter = styled_components_1.default.div.withConfig({ displayName: "brc-sc-GoldenCenter", componentId: "brc-sc-zgl3am" }) ` display: flex; align-items: center; justify-content: center; height: calc(100vh * 1 / ${({ theme }) => theme.goldenRatio}); `; const LoadingContent = styled_components_1.default.div.withConfig({ displayName: "brc-sc-LoadingContent", componentId: "brc-sc-18zolej" }) ` display: flex; flex-flow: column nowrap; align-items: center; & > ${loading_dots_js_1.default} { color: ${({ theme }) => theme.navPrimary}; margin: 24px 0; } & > ${cdn_asset_js_1.default} { height: 190px; } `; const LoadingView = (_a) => { var { className, message = null, illustration } = _a, props = __rest(_a, ["className", "message", "illustration"]); const theme = (0, styled_components_1.useTheme)(); const defaultDirectory = (0, is_rebrand_js_1.default)(theme) ? 'illustrations' : 'design-assets/illustrations'; return ((0, jsx_runtime_1.jsx)(GoldenCenter, Object.assign({ className: className, "data-testid": "loading-view" }, props, { children: (0, jsx_runtime_1.jsxs)(LoadingContent, { children: [message, (0, jsx_runtime_1.jsx)(loading_dots_js_1.default, {}), illustration ? (0, jsx_runtime_1.jsx)(cdn_asset_js_1.default, { directory: defaultDirectory, filename: illustration }) : null] }) }))); }; LoadingView.displayName = 'LoadingView'; exports.default = LoadingView; //# sourceMappingURL=loading-view.js.map