Skip to content

Commit

Permalink
[Playground] EuiTab (#3910)
Browse files Browse the repository at this point in the history
Co-authored-by: Greg Thompson <[email protected]>
  • Loading branch information
anishagg17 and thompsongl authored Aug 18, 2020
1 parent 734e0cb commit 635ceb1
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
48 changes: 48 additions & 0 deletions src-docs/src/views/tabs/playground.js
Original file line number Diff line number Diff line change
@@ -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,
},
},
};
};
2 changes: 2 additions & 0 deletions src-docs/src/views/tabs/tabs_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
EuiTab,
EuiTabbedContent,
} from '../../../../src/components';
import { tabConfig } from './playground';

import Tabs from './tabs';
const tabsSource = require('!!raw-loader!./tabs');
Expand Down Expand Up @@ -161,4 +162,5 @@ export const TabsExample = {
demo: <Controlled />,
},
],
playground: tabConfig,
};

0 comments on commit 635ceb1

Please sign in to comment.