UNPKG

apiconnect-explorer

Version:

- [Getting Started](#getting-started) - [Configuration](#configuration) * [Required](#required) * [Optional](#optional) - [Usage in React](#usage-in-react) - [Usage outside of React](#usage-outside-of-react) - [Detailed description of options](#detail

1 lines 1.53 kB
import a,{useMemo as b,useContext as c}from"react";import{I18nextProvider as d}from"react-i18next";import e,{ConfigContext as f}from"./contexts/config/index.js";import g from"./App.js";import h from"./utils/i18n.js";import{MemoryRouter as i,HashRouter as j}from"react-router-dom";import{Theme as k}from"@carbon/react";import"./css/main.scss";function l(e){var g=e.children,i=c(f),j=b(function(){return h({explorerDir:i.options.explorerDir,locale:i.options.locale})},[i.options.explorerDir,i.options.locale]);return a.createElement("div",{dir:j.dir(),className:"apiconnect-explorer-container"},a.createElement(d,{i18n:j},g))}function m(b){var d=b.children,e=c(f),g=i,h=e.options.routerType?e.options.routerType:e.constants.MEMORY_ROUTER;if(h===e.constants.HASH_ROUTER)g=j;else if(h!==e.constants.MEMORY_ROUTER)throw new Error("Unsupported router type: '".concat(e.options.routerType,"'. Available options: ").concat(e.constants.MEMORY_ROUTER,", ").concat(e.constants.HASH_ROUTER));return a.createElement(g,null,d)}var n={white:"light",g10:"light",g90:"dark",g100:"dark"};function o(){var b,d,e=c(f),h=(null===(b=e.options)||void 0===b?void 0:b.theme)||"white",i=null!==(d=n[h])&&void 0!==d?d:"light",j="apic-explorer-".concat(i);return a.createElement(k,{theme:h,className:j},a.createElement(l,null,a.createElement(m,null,a.createElement(g,null))))}function p(b){var c=b.options,d=b.apis,f=b.encodedApis,g=b.apps,h=b.docs;return a.createElement(e,{options:c,apis:d,encodedApis:f,apps:g,docs:h},a.createElement(o,null))}export default p;