UNPKG

@navinc/base-react-components

Version:
19 lines 794 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.WaitForDependencies = void 0; const WaitForDependencies = ({ children, ErrorContent, LoadingContent, loadingProps = [], hasDependencyProps = [], }) => { const hasAllDataDependencies = hasDependencyProps.reduce((accumulator, current) => current && accumulator, true); const areAnyLoading = loadingProps.reduce((accumulator, current) => current || accumulator, false); if (hasAllDataDependencies) { return children; } else if (areAnyLoading && LoadingContent) { return LoadingContent; } else if (ErrorContent) { return ErrorContent; } return null; }; exports.WaitForDependencies = WaitForDependencies; //# sourceMappingURL=wait-for-dependencies.js.map