Skip to content

Commit

Permalink
[Playground] EuiImage (#3806)
Browse files Browse the repository at this point in the history
  • Loading branch information
anishagg17 authored Jul 28, 2020
1 parent c8b7668 commit a4f1d74
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src-docs/src/views/image/image_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { renderToHtml } from '../../services';
import { GuideSectionTypes } from '../../components';

import { EuiCode, EuiImage } from '../../../../src/components';
import imageConfig from './playground';

import Image from './image';
const imageSource = require('!!raw-loader!./image');
Expand Down Expand Up @@ -115,4 +116,5 @@ export const ImageExample = {
snippet: imageSizesSnippet,
},
],
playground: imageConfig,
};
41 changes: 41 additions & 0 deletions src-docs/src/views/image/playground.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { PropTypes } from 'react-view';
import { EuiImage } from '../../../../src/components/';
import { propUtilityForPlayground } from '../../services/playground';

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

propsToUse.size = {
...propsToUse.size,
type: PropTypes.Enum,
options: {
original: 'original',
s: 's',
m: 'm',
l: 'l',
xl: 'xl',
fullWidth: 'fullWidth',
},
defaultValue: 'original',
};
propsToUse.url.value = 'https://source.unsplash.com/100x100/?Nature';
propsToUse.alt.value = 'image_alt';

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

0 comments on commit a4f1d74

Please sign in to comment.