Skip to content

Commit

Permalink
export reused api explorer functionality from root index.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
josephaxisa committed Nov 2, 2021
1 parent 5624c72 commit 4472068
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 13 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 @@ -72,9 +72,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,
envAdaptor,
setVersionsUrl,
Expand Down Expand Up @@ -242,11 +242,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.
2 changes: 1 addition & 1 deletion packages/api-explorer/src/StandaloneApiExplorer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import type { IAPIMethods } from '@looker/sdk-rtl'
import type { SpecList } from '@looker/sdk-codegen'
import { Provider } from 'react-redux'

import ApiExplorer from './ApiExplorer'
import { ApiExplorer } from './ApiExplorer'
import { store } from './state'
import { StandaloneEnvAdaptor } from './utils'
import { Loader } from './components'
Expand Down
30 changes: 30 additions & 0 deletions packages/api-explorer/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
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 type { ThemeOverrides, IApixEnvAdaptor } from './utils'
export { getThemeOverrides } from './utils'
export { Loader } from './components'
export { store } 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 { ExtensionEnvAdaptor } from './utils'

Expand Down
7 changes: 2 additions & 5 deletions packages/extension-api-explorer/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,8 @@
SOFTWARE.
*/
import type {
IApixEnvAdaptor,
ThemeOverrides,
} from '@looker/api-explorer/src/utils'
import { getThemeOverrides } from '@looker/api-explorer/src/utils'
import type { IApixEnvAdaptor, ThemeOverrides } from '@looker/api-explorer'
import { getThemeOverrides } from '@looker/api-explorer'
import type { ExtensionSDK } from '@looker/extension-sdk'

/**
Expand Down

0 comments on commit 4472068

Please sign in to comment.