Skip to content

Commit

Permalink
[Playground] EuiPagination (#3898)
Browse files Browse the repository at this point in the history
* [Playground] EuiPagination

* used dummyFuntion
  • Loading branch information
anishagg17 authored Aug 12, 2020
1 parent 753e978 commit 38c2319
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src-docs/src/views/pagination/pagination_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import {
EuiPaginationButton,
} from '../../../../src/components';

import { paginationConfig } from './playground';

import ManyPages from './many_pages';
const manyPagesSource = require('!!raw-loader!./many_pages');
const manyPagesHtml = renderToHtml(ManyPages);
Expand Down Expand Up @@ -201,4 +203,5 @@ export const PaginationExample = {
demo: <CustomizablePagination />,
},
],
playground: paginationConfig,
};
43 changes: 43 additions & 0 deletions src-docs/src/views/pagination/playground.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { PropTypes } from 'react-view';
import { EuiPagination, EuiText } from '../../../../src/components/';
import {
propUtilityForPlayground,
dummyFunction,
} from '../../services/playground';

export const paginationConfig = () => {
const docgenInfo = Array.isArray(EuiPagination.__docgenInfo)
? EuiPagination.__docgenInfo[0]
: EuiPagination.__docgenInfo;
const propsToUse = propUtilityForPlayground(docgenInfo.props);

propsToUse.onPageClick = {
...propsToUse.onPageClick,
type: PropTypes.Custom,
value: undefined,
custom: {
...propsToUse.onPageClick.custom,
use: 'switch',
label: 'Simulate',
},
};

return {
config: {
componentName: 'EuiPagination',
props: propsToUse,
scope: {
EuiPagination,
EuiText,
},
imports: {
'@elastic/eui': {
named: ['EuiPagination', 'EuiText'],
},
},
customProps: {
onPageClick: dummyFunction,
},
},
};
};

0 comments on commit 38c2319

Please sign in to comment.