Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: export reused api explorer functionality from root index.ts #890

Merged
merged 9 commits into from
Nov 4, 2021
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
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
28 changes: 28 additions & 0 deletions packages/api-explorer/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*

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 { ApiExplorer } from './ApiExplorer'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any compile issues with this? We've had to use export * elsewhere. Are there any other exports? if no consider switching to export *

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',
})
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'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏼

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