diff --git a/packages/api-explorer/src/ApiExplorer.tsx b/packages/api-explorer/src/ApiExplorer.tsx index a4343c4a5..d30a48dcd 100644 --- a/packages/api-explorer/src/ApiExplorer.tsx +++ b/packages/api-explorer/src/ApiExplorer.tsx @@ -77,9 +77,9 @@ export interface ApiExplorerProps { headless?: boolean } -export const BodyOverride = createGlobalStyle` html { height: 100%; overflow: hidden; } ` +const BodyOverride = createGlobalStyle` html { height: 100%; overflow: hidden; } ` -const ApiExplorer: FC = ({ +export const ApiExplorer: FC = ({ specs, adaptor, setVersionsUrl, @@ -247,11 +247,10 @@ const ApiExplorer: FC = ({ ) } -export const AsideBorder = styled(Aside)<{ +const AsideBorder = styled(Aside)<{ isOpen: boolean headless: boolean }>` width: ${({ isOpen, headless }) => isOpen ? '20rem' : headless ? '2.75rem' : '0rem'}; ` -export default ApiExplorer diff --git a/packages/api-explorer/src/index.tsx b/packages/api-explorer/src/App.tsx similarity index 100% rename from packages/api-explorer/src/index.tsx rename to packages/api-explorer/src/App.tsx diff --git a/packages/api-explorer/src/StandaloneApiExplorer.tsx b/packages/api-explorer/src/StandaloneApiExplorer.tsx index b4a4dc42a..7f1d6607c 100644 --- a/packages/api-explorer/src/StandaloneApiExplorer.tsx +++ b/packages/api-explorer/src/StandaloneApiExplorer.tsx @@ -37,9 +37,9 @@ import { import type { IAPIMethods } from '@looker/sdk-rtl' import type { SpecList } from '@looker/sdk-codegen' import { Provider } from 'react-redux' - import { BrowserAdaptor } from '@looker/extension-utils' -import ApiExplorer from './ApiExplorer' + +import { ApiExplorer } from './ApiExplorer' import { store } from './state' import { Loader } from './components' diff --git a/packages/api-explorer/src/components/ErrorBoundary/components/SomethingWentWrong/SomethingWentWrong.spec.tsx b/packages/api-explorer/src/components/ErrorBoundary/components/SomethingWentWrong/SomethingWentWrong.spec.tsx index 5ba3d424c..79a90c996 100644 --- a/packages/api-explorer/src/components/ErrorBoundary/components/SomethingWentWrong/SomethingWentWrong.spec.tsx +++ b/packages/api-explorer/src/components/ErrorBoundary/components/SomethingWentWrong/SomethingWentWrong.spec.tsx @@ -54,6 +54,6 @@ describe('SomethingWentWrong', () => { expect(screen.getByText(header)).toBeVisible() expect(screen.getByText(actionMessage)).toBeVisible() - expect(screen.getByAltText(altText)).toBeVisible() + expect(screen.getByTitle(altText)).toBeInTheDocument() }) }) diff --git a/packages/api-explorer/src/components/ErrorBoundary/components/SomethingWentWrong/components/SomethingWentWrongGraphic/SomethingWentWrongGraphic.tsx b/packages/api-explorer/src/components/ErrorBoundary/components/SomethingWentWrong/components/SomethingWentWrongGraphic/SomethingWentWrongGraphic.tsx index e74a1510b..9124946ec 100644 --- a/packages/api-explorer/src/components/ErrorBoundary/components/SomethingWentWrong/components/SomethingWentWrongGraphic/SomethingWentWrongGraphic.tsx +++ b/packages/api-explorer/src/components/ErrorBoundary/components/SomethingWentWrong/components/SomethingWentWrongGraphic/SomethingWentWrongGraphic.tsx @@ -24,8 +24,6 @@ */ import React from 'react' -import { Box } from '@looker/components' -import somethingWentWrong from './somethingWentWrong.svg' interface SomethingWentWrongGraphicProps { altText?: string @@ -34,9 +32,175 @@ interface SomethingWentWrongGraphicProps { /** * Graphic to be used when something goes wrong on a page */ -export const SomethingWentWrongGraphic: React.FC = +const SomethingWentWrongGraphicImage: React.FC = ({ altText }) => ( - - {altText - + + {altText || 'error graphic'} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ) + +export const SomethingWentWrongGraphic = React.memo( + SomethingWentWrongGraphicImage +) diff --git a/packages/api-explorer/src/components/ErrorBoundary/components/SomethingWentWrong/components/SomethingWentWrongGraphic/somethingWentWrong.svg b/packages/api-explorer/src/components/ErrorBoundary/components/SomethingWentWrong/components/SomethingWentWrongGraphic/somethingWentWrong.svg deleted file mode 100644 index c6040f128..000000000 --- a/packages/api-explorer/src/components/ErrorBoundary/components/SomethingWentWrong/components/SomethingWentWrongGraphic/somethingWentWrong.svg +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/api-explorer/src/index.ts b/packages/api-explorer/src/index.ts new file mode 100644 index 000000000..b958d63ac --- /dev/null +++ b/packages/api-explorer/src/index.ts @@ -0,0 +1,29 @@ +/* + + MIT License + + Copyright (c) 2021 Looker Data Sciences, Inc. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. + + */ +export * from './ApiExplorer' +export * from './StandaloneApiExplorer' +export * from './components' +export * from './state' diff --git a/packages/api-explorer/webpack.dev.config.js b/packages/api-explorer/webpack.dev.config.js index 877b3b7ca..ad78f8436 100644 --- a/packages/api-explorer/webpack.dev.config.js +++ b/packages/api-explorer/webpack.dev.config.js @@ -30,6 +30,9 @@ const base = require('../../webpack.base.config')(__dirname) const browser = require('../../webpack.browser.config')() module.exports = merge(base, browser, { + entry: { + app: path.join(__dirname, 'src/App.tsx'), + }, mode: 'development', devServer: { contentBase: path.join(__dirname, 'public'), diff --git a/packages/api-explorer/webpack.prod.config.js b/packages/api-explorer/webpack.prod.config.js index 16843d8e9..9de0e620f 100644 --- a/packages/api-explorer/webpack.prod.config.js +++ b/packages/api-explorer/webpack.prod.config.js @@ -23,10 +23,14 @@ SOFTWARE. */ +const path = require('path') const { merge } = require('webpack-merge') const base = require('../../webpack.base.config')(__dirname) const browser = require('../../webpack.browser.config')() module.exports = merge(base, browser, { + entry: { + app: path.join(__dirname, 'src/index.ts'), + }, mode: 'production', }) diff --git a/packages/extension-api-explorer/src/ExtensionApiExplorer.tsx b/packages/extension-api-explorer/src/ExtensionApiExplorer.tsx index 303f00434..47bf05c96 100644 --- a/packages/extension-api-explorer/src/ExtensionApiExplorer.tsx +++ b/packages/extension-api-explorer/src/ExtensionApiExplorer.tsx @@ -32,10 +32,8 @@ import type { ExtensionContextData } from '@looker/extension-sdk-react' import { ExtensionContext } from '@looker/extension-sdk-react' import type { SpecItem, SpecList } from '@looker/sdk-codegen' import { getSpecsFromVersions } from '@looker/sdk-codegen' -import ApiExplorer from '@looker/api-explorer/src/ApiExplorer' -import { Loader } from '@looker/api-explorer/src/components' +import { ApiExplorer, store, Loader } from '@looker/api-explorer' import { getExtensionSDK } from '@looker/extension-sdk' -import { store } from '@looker/api-explorer/src/state' import { Provider } from 'react-redux' import { ExtensionAdaptor } from '@looker/extension-utils'