From 02395f1724774d60d3f6e06518d4311f1e12b67b Mon Sep 17 00:00:00 2001 From: Anish Aggarwal Date: Thu, 13 Aug 2020 22:58:27 +0530 Subject: [PATCH] [Playground] EuiTab --- src-docs/src/views/tabs/playground.js | 48 +++++++++++++++++++++++++ src-docs/src/views/tabs/tabs_example.js | 2 ++ 2 files changed, 50 insertions(+) create mode 100644 src-docs/src/views/tabs/playground.js diff --git a/src-docs/src/views/tabs/playground.js b/src-docs/src/views/tabs/playground.js new file mode 100644 index 00000000000..639f7e1ecff --- /dev/null +++ b/src-docs/src/views/tabs/playground.js @@ -0,0 +1,48 @@ +import { + propUtilityForPlayground, + dummyFunction, +} from '../../services/playground'; +import { EuiTab } from '../../../../src/components/'; +import { PropTypes } from 'react-view'; + +export const tabConfig = () => { + const docgenInfo = Array.isArray(EuiTab.__docgenInfo) + ? EuiTab.__docgenInfo[0] + : EuiTab.__docgenInfo; + const propsToUse = propUtilityForPlayground(docgenInfo.props); + + propsToUse.onClick = { + ...propsToUse.onClick, + type: PropTypes.Custom, + value: undefined, + custom: { + ...propsToUse.onClick.custom, + use: 'switch', + label: 'Simulate', + }, + }; + + propsToUse.children = { + ...propsToUse.children, + type: PropTypes.String, + value: 'Tab content', + }; + + return { + config: { + componentName: 'EuiTab', + props: propsToUse, + scope: { + EuiTab, + }, + imports: { + '@elastic/eui': { + named: ['EuiTab'], + }, + }, + customProps: { + onClick: dummyFunction, + }, + }, + }; +}; diff --git a/src-docs/src/views/tabs/tabs_example.js b/src-docs/src/views/tabs/tabs_example.js index ac4240b78d3..b74782fd049 100644 --- a/src-docs/src/views/tabs/tabs_example.js +++ b/src-docs/src/views/tabs/tabs_example.js @@ -9,6 +9,7 @@ import { EuiTab, EuiTabbedContent, } from '../../../../src/components'; +import { tabConfig } from './playground'; import Tabs from './tabs'; const tabsSource = require('!!raw-loader!./tabs'); @@ -161,4 +162,5 @@ export const TabsExample = { demo: , }, ], + playground: tabConfig, };