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] EuiSpacer, EuiHorizontalRule #3868

Merged
merged 5 commits into from
Aug 10, 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
12 changes: 8 additions & 4 deletions src-docs/src/services/playground/playground.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useView, Compiler, Placeholder } from 'react-view';
import { EuiSpacer, EuiTitle, EuiCodeBlock } from '../../../../src/components';
import Knobs from './knobs';

export default ({ config, setGhostBackground }) => {
export default ({ config, setGhostBackground, playgroundClassName }) => {
const getSnippet = code => {
let regex = /return \(([\S\s]*?)(;)$/gm;
let newCode = code.match(regex);
Expand Down Expand Up @@ -45,9 +45,13 @@ export default ({ config, setGhostBackground }) => {
}
}, [params.knobProps]);

const compilerClasses = classNames('playgroundCompiler', {
playgroundCompiler__ghostBackground: isGhost,
});
const compilerClasses = classNames(
'playgroundCompiler',
{
playgroundCompiler__ghostBackground: isGhost,
},
playgroundClassName
);

return (
<React.Fragment>
Expand Down
3 changes: 3 additions & 0 deletions src-docs/src/views/horizontal_rule/horizontal_rule_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { GuideSectionTypes } from '../../components';

import { EuiHorizontalRule } from '../../../../src/components';

import { horizontalRuleConfig } from './playground';

import HorizontalRule from './horizontal_rule';
const horizontalRuleSource = require('!!raw-loader!./horizontal_rule');
const horizontalRuleHtml = renderToHtml(HorizontalRule);
Expand Down Expand Up @@ -64,4 +66,5 @@ export const HorizontalRuleExample = {
demo: <HorizontalRuleMargin />,
},
],
playground: horizontalRuleConfig,
};
24 changes: 24 additions & 0 deletions src-docs/src/views/horizontal_rule/playground.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { EuiHorizontalRule } from '../../../../src/components/';
import { propUtilityForPlayground } from '../../services/playground';

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

return {
config: {
componentName: 'EuiHorizontalRule',
props: propsToUse,
scope: {
EuiHorizontalRule,
},
imports: {
'@elastic/eui': {
named: ['EuiHorizontalRule'],
},
},
},
};
};
25 changes: 25 additions & 0 deletions src-docs/src/views/spacer/playground.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { EuiSpacer } from '../../../../src/components/';
import { propUtilityForPlayground } from '../../services/playground';

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

return {
config: {
componentName: 'EuiSpacer',
props: propsToUse,
scope: {
EuiSpacer,
},
imports: {
'@elastic/eui': {
named: ['EuiSpacer'],
},
},
},
playgroundClassName: 'guideDemo__highlightSpacer',
};
};
3 changes: 3 additions & 0 deletions src-docs/src/views/spacer/spacer_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { GuideSectionTypes } from '../../components';

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

import { spacerConfig } from './playground';

import Spacer from './spacer';
const spacerSource = require('!!raw-loader!./spacer');
const spacerHtml = renderToHtml(Spacer);
Expand Down Expand Up @@ -48,4 +50,5 @@ export const SpacerExample = {
),
},
],
playground: spacerConfig,
};