Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Playgorund] EuiEmptyPrompt #3885

Merged
merged 3 commits into from
Aug 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'],
},
},
},
};
};