Skip to content

Commit

Permalink
[Playgorund] EuiEmptyPrompt (#3885)
Browse files Browse the repository at this point in the history
* playgorund

* Update src-docs/src/views/empty_prompt/playground.js

Co-authored-by: Greg Thompson <thompson.glowe@gmail.com>

* Update src-docs/src/views/empty_prompt/playground.js

Co-authored-by: Greg Thompson <thompson.glowe@gmail.com>

Co-authored-by: Greg Thompson <thompson.glowe@gmail.com>
  • Loading branch information
2 people authored and nyurik committed Aug 18, 2020
1 parent a4060e6 commit 53c78a5
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src-docs/src/views/empty_prompt/empty_prompt_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { GuideSectionTypes } from '../../components';

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

import emptyPromptConfig from './playground';

import EmptyPrompt from './empty_prompt';
const emptyPromptSource = require('!!raw-loader!./empty_prompt');
const emptyPromptHtml = renderToHtml(EmptyPrompt);
Expand Down Expand Up @@ -107,4 +109,5 @@ export const EmptyPromptExample = {
snippet: simpleSnippet,
},
],
playground: emptyPromptConfig,
};
59 changes: 59 additions & 0 deletions src-docs/src/views/empty_prompt/playground.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import { PropTypes } from 'react-view';
import { EuiEmptyPrompt, EuiButton } from '../../../../src/components/';
import {
propUtilityForPlayground,
iconValidator,
} from '../../services/playground';

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

propsToUse.title = {
...propsToUse.title,
value: '<>You have no spice</>',
type: PropTypes.ReactNode,
};

propsToUse.iconColor = {
...propsToUse.iconColor,
type: PropTypes.Enum,
defaultValue: 'subdued',
options: {
default: 'default',
subdued: 'subdued',
secondary: 'secondary',
accent: 'accent',
danger: 'danger',
warning: 'warning',
ghost: 'ghost',
},
};

propsToUse.actions.type = PropTypes.String;
propsToUse.body.type = PropTypes.String;
propsToUse.body.value = `Navigators use massive amounts of spice to gain a limited form of
prescience. This allows them to safely navigate interstellar space,
enabling trade and travel throughout the galaxy.
`;

propsToUse.iconType = iconValidator(propsToUse.iconType);

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

0 comments on commit 53c78a5

Please sign in to comment.