diff --git a/src-docs/src/components/guide_section/guide_section.js b/src-docs/src/components/guide_section/guide_section.js index b61815f4bf4..53037c6e388 100644 --- a/src-docs/src/components/guide_section/guide_section.js +++ b/src-docs/src/components/guide_section/guide_section.js @@ -158,14 +158,28 @@ export class GuideSection extends Component { return; } - return [ - - - - {snippet} - - - ]; + let snippetCode; + if (typeof snippet === 'string') { + snippetCode = ( + + + + {snippet} + + + ); + } else { + snippetCode = snippet.map((snip, index) => ( + + + + {snip} + + + )); + } + + return snippetCode; } renderPropsForComponent = (componentName, component) => { @@ -413,7 +427,10 @@ GuideSection.propTypes = { title: PropTypes.string, id: PropTypes.string, source: PropTypes.array, - snippet: PropTypes.string, + snippet: PropTypes.oneOfType([ + PropTypes.string, + PropTypes.arrayOf(PropTypes.string), + ]), children: PropTypes.any, toggleTheme: PropTypes.func.isRequired, theme: PropTypes.string.isRequired, diff --git a/src-docs/src/views/icon/icon_example.js b/src-docs/src/views/icon/icon_example.js index 9a67d8af5b4..f2434a8059e 100644 --- a/src-docs/src/views/icon/icon_example.js +++ b/src-docs/src/views/icon/icon_example.js @@ -31,17 +31,15 @@ const iconsSnippet = ``; import Tokens from './tokens'; const tokensSource = require('!!raw-loader!./tokens'); -const tokensSnippet = ` - -`, + ` - -`, + ` shape: 'rectangle', hideBorder: true }} -/>`; +/>`]; import Apps from './apps'; @@ -74,23 +72,18 @@ const iconSizesSnippet = ``; import IconColors from './icon_colors'; const iconColorsSource = require('!!raw-loader!./icon_colors'); -const iconColorsSnippet = ` - -`; +const iconColorsSnippet = [``, + ``]; import Accessibility from './accessibility'; const accessibilitySource = require('!!raw-loader!./accessibility'); import IconTypes from './icon_types'; const iconTypesSource = require('!!raw-loader!./icon_types'); -const iconTypesSnippet = ` - - - - - -Works in other components too -`; +const iconTypesSnippet = [``, + ``, + ``, + `Works in other components too`]; export const IconExample = { title: 'Icons',