Skip to content

Commit

Permalink
[Playground] EuiHighlight , EuiMark (#3902)
Browse files Browse the repository at this point in the history
  • Loading branch information
anishagg17 authored and nyurik committed Aug 18, 2020
1 parent 30d30e4 commit c3b87b4
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { GuideSectionTypes } from '../../components';

import { EuiCode, EuiHighlight, EuiMark } from '../../../../src/components';

import { highlightConfig, markConfig } from './playground';

import { Highlight } from './highlight';
import { Mark } from './mark';

Expand Down Expand Up @@ -69,4 +71,5 @@ export const HighlightAndMarkExample = {
demo: <Mark />,
},
],
playground: [highlightConfig, markConfig],
};
62 changes: 62 additions & 0 deletions src-docs/src/views/highlight_and_mark/playground.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { PropTypes } from 'react-view';
import { EuiHighlight, EuiMark } from '../../../../src/components/';
import { propUtilityForPlayground } from '../../services/playground';

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

propsToUse.children = {
...propsToUse.children,
type: PropTypes.String,
hidden: false,
value: 'The quick brown fox jumped over the lazy dog',
};

propsToUse.search = {
...propsToUse.search,
type: PropTypes.String,
hidden: false,
};

return {
config: {
componentName: 'EuiHighlight',
props: propsToUse,
scope: {
EuiHighlight,
},
imports: {
'@elastic/eui': {
named: ['EuiHighlight'],
},
},
},
};
};

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

propsToUse.children.value = 'mark';

return {
config: {
componentName: 'EuiMark',
props: propsToUse,
scope: {
EuiMark,
},
imports: {
'@elastic/eui': {
named: ['EuiMark'],
},
},
},
};
};

0 comments on commit c3b87b4

Please sign in to comment.