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

[Playground] EuiFlexGroup, EuiFlexItem #3892

Merged
merged 5 commits into from
Aug 13, 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/flex/flex_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import {
EuiLink,
} from '../../../../src/components';

import { flexGroupConfig, flexGridConfig } from './playground';

import FlexGroup from './flex_group';
const flexGroupSource = require('!!raw-loader!./flex_group');
const flexGroupHtml = renderToHtml(FlexGroup);
Expand Down Expand Up @@ -624,4 +626,5 @@ export const FlexExample = {
),
},
],
playground: [flexGroupConfig, flexGridConfig],
};
89 changes: 89 additions & 0 deletions src-docs/src/views/flex/playground.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
import { PropTypes } from 'react-view';
import {
EuiFlexGroup,
EuiFlexItem,
EuiFlexGrid,
} from '../../../../src/components/';
import { propUtilityForPlayground } from '../../services/playground';

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

propsToUse.children = {
type: PropTypes.ReactNode,
value: `<EuiFlexItem>Content grid item</EuiFlexItem>
<EuiFlexItem style={{ minWidth: 100 }}>Min-width 300px</EuiFlexItem>
<EuiFlexItem component="span">
This is a span component
</EuiFlexItem>
<EuiFlexItem>
<p>Another content grid item</p>
<p>
Note how both of these are the same width and height despite having
different content?
</p>
</EuiFlexItem>`,
hidden: false,
};

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

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

propsToUse.children = {
type: PropTypes.ReactNode,
value: `<EuiFlexItem>Content grid item</EuiFlexItem>
<EuiFlexItem style={{ minWidth: 100 }}>Min-width 300px</EuiFlexItem>
<EuiFlexItem component="span">
This is a span component
</EuiFlexItem>
<EuiFlexItem>
<p>Another content grid item</p>
<p>
Note how both of these are the same width and height despite having
different content?
</p>
</EuiFlexItem>`,
hidden: false,
};

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