diff --git a/superset-frontend/.storybook/main.js b/superset-frontend/.storybook/main.js index d0d017db53d41..ee9acd0caebae 100644 --- a/superset-frontend/.storybook/main.js +++ b/superset-frontend/.storybook/main.js @@ -22,7 +22,7 @@ const path = require('path'); const customConfig = require('../webpack.config.js'); module.exports = { - stories: ['../src/components/**/*.stories.@(t|j)sx'], +stories: ['../src/@(components|common)/**/*.stories.@(t|j)sx'], addons: [ '@storybook/addon-essentials', '@storybook/addon-links', diff --git a/superset-frontend/src/common/components/Tabs.tsx b/superset-frontend/src/common/components/Tabs.tsx index dde0102fa5e4f..0d358ad6e6c3a 100644 --- a/superset-frontend/src/common/components/Tabs.tsx +++ b/superset-frontend/src/common/components/Tabs.tsx @@ -17,9 +17,9 @@ * under the License. */ import styled from '@superset-ui/style'; -import { Tabs as BaseTabs } from 'src/common/components'; +import { Tabs as AntdTabs } from 'src/common/components'; -const Tabs = styled(BaseTabs)` +const StyledTabs = styled(AntdTabs)` margin-top: -18px; .ant-tabs-nav-list { @@ -52,4 +52,10 @@ const Tabs = styled(BaseTabs)` } `; +const StyledTabPane = styled(AntdTabs.TabPane)``; + +const Tabs = Object.assign(StyledTabs, { + TabPane: StyledTabPane, +}); + export default Tabs; diff --git a/superset-frontend/src/common/components/common.stories.tsx b/superset-frontend/src/common/components/common.stories.tsx new file mode 100644 index 0000000000000..3ed541d26a312 --- /dev/null +++ b/superset-frontend/src/common/components/common.stories.tsx @@ -0,0 +1,61 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import React from 'react'; +import { action } from '@storybook/addon-actions'; +import { withKnobs, boolean } from '@storybook/addon-knobs'; +import Modal from './Modal'; +import Tabs from './Tabs'; + +export default { + title: 'Common Components', + decorators: [withKnobs], +}; + +export const StyledModal = () => ( + +
hi!
+
+); + +export const StyledTabs = () => ( + + + Tab 1 Content! + + + Tab 2 Content! + + +); diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal.tsx b/superset-frontend/src/views/CRUD/data/database/DatabaseModal.tsx index 4944e2a35fd2d..bc4e3d114e2cf 100644 --- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal.tsx +++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal.tsx @@ -23,7 +23,6 @@ import withToasts from 'src/messageToasts/enhancers/withToasts'; import Icon from 'src/components/Icon'; import Modal from 'src/common/components/Modal'; import Tabs from 'src/common/components/Tabs'; -import { Tabs as BaseTabs } from 'src/common/components'; export type DatabaseObject = { id?: number; @@ -41,8 +40,6 @@ interface DatabaseModalProps { database?: DatabaseObject | null; // If included, will go into edit mode } -const { TabPane } = BaseTabs; - const StyledIcon = styled(Icon)` margin: auto ${({ theme }) => theme.gridUnit * 2}px auto 0; `; @@ -160,7 +157,7 @@ const DatabaseModal: FunctionComponent = ({ } > - {t('Connection')} @@ -210,19 +207,19 @@ const DatabaseModal: FunctionComponent = ({ {t(' for more information on how to structure your URI.')} - - {t('Performance')}} key="2"> + + {t('Performance')}} key="2"> Performance Form Data - - {t('SQL Lab Settings')}} key="3"> + + {t('SQL Lab Settings')}} key="3"> SQL Lab Settings Form Data - - {t('Security')}} key="4"> + + {t('Security')}} key="4"> Security Form Data - - {t('Extra')}} key="5"> + + {t('Extra')}} key="5"> Extra Form Data - + );