Skip to content

Commit

Permalink
chore: export reused api explorer functionality from root index.ts (#890
Browse files Browse the repository at this point in the history
)

* export reused api explorer functionality from root index.ts

Co-authored-by: Bryn Ryans <bryn.ryans@looker.com>
  • Loading branch information
josephaxisa and bryans99 authored Nov 4, 2021
1 parent 16528bc commit fb8634f
Show file tree
Hide file tree
Showing 10 changed files with 213 additions and 61 deletions.
7 changes: 3 additions & 4 deletions packages/api-explorer/src/ApiExplorer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<ApiExplorerProps> = ({
export const ApiExplorer: FC<ApiExplorerProps> = ({
specs,
adaptor,
setVersionsUrl,
Expand Down Expand Up @@ -247,11 +247,10 @@ const ApiExplorer: FC<ApiExplorerProps> = ({
)
}

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
File renamed without changes.
4 changes: 2 additions & 2 deletions packages/api-explorer/src/StandaloneApiExplorer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})
})

Large diffs are not rendered by default.

This file was deleted.

29 changes: 29 additions & 0 deletions packages/api-explorer/src/index.ts
Original file line number Diff line number Diff line change
@@ -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'
3 changes: 3 additions & 0 deletions packages/api-explorer/webpack.dev.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down
4 changes: 4 additions & 0 deletions packages/api-explorer/webpack.prod.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
})
4 changes: 1 addition & 3 deletions packages/extension-api-explorer/src/ExtensionApiExplorer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down

0 comments on commit fb8634f

Please sign in to comment.