From 70e901319447219ffc7527d66f855d0af379bc7d Mon Sep 17 00:00:00 2001 From: Alexander Fedyashov Date: Sat, 15 Jul 2017 13:53:30 +0300 Subject: [PATCH 1/5] docs(Example): add ShorthandExample and ability to version docs --- .../ComponentDoc/ComponentExample.js | 81 +++++++++++-------- .../app/Components/ComponentDoc/SUIVersion.js | 20 +++++ .../ComponentDoc/ShorthandExample.js | 16 ++++ docs/app/index.ejs | 3 - 4 files changed, 82 insertions(+), 38 deletions(-) create mode 100644 docs/app/Components/ComponentDoc/SUIVersion.js create mode 100644 docs/app/Components/ComponentDoc/ShorthandExample.js diff --git a/docs/app/Components/ComponentDoc/ComponentExample.js b/docs/app/Components/ComponentDoc/ComponentExample.js index 261e84fa59..91792952e4 100644 --- a/docs/app/Components/ComponentDoc/ComponentExample.js +++ b/docs/app/Components/ComponentDoc/ComponentExample.js @@ -11,6 +11,7 @@ import { exampleContext, repoURL } from 'docs/app/utils' import { Divider, Grid, Icon, Header, Menu, Popup } from 'src' import Editor from 'docs/app/Components/Editor/Editor' import { scrollToAnchor } from 'docs/app/utils' +import SUIVersion from './SUIVersion' const babelConfig = { presets: ['es2015', 'react', 'stage-1'], @@ -66,6 +67,7 @@ class ComponentExample extends Component { history: PropTypes.object.isRequired, location: PropTypes.object.isRequired, match: PropTypes.object.isRequired, + suiVersion: PropTypes.string, title: PropTypes.node, } @@ -388,7 +390,7 @@ class ComponentExample extends Component { } render() { - const { children, description, title } = this.props + const { children, description, suiVersion, title } = this.props const { copiedDirectLink, exampleElement, showCode, showHTML } = this.state const exampleStyle = {} @@ -397,41 +399,50 @@ class ComponentExample extends Component { } return ( - - - {title &&
} - {description &&

{description}

} - - - - - - - - - - - - - - - - - - - - - - - - {children && ( - - {children} + + + + {title &&
} + {description &&

{description}

} - )} - - {exampleElement} - + + + + + + + + + + + + + + + + + + + + + + + + + {suiVersion && } + + + + + {children && {children}} + + + + + {exampleElement} + + + {this.renderJSX()} {this.renderHTML()} diff --git a/docs/app/Components/ComponentDoc/SUIVersion.js b/docs/app/Components/ComponentDoc/SUIVersion.js new file mode 100644 index 0000000000..72178fdb2e --- /dev/null +++ b/docs/app/Components/ComponentDoc/SUIVersion.js @@ -0,0 +1,20 @@ +import PropTypes from 'prop-types' +import React from 'react' + +import { Label } from 'src' + +const SUIVersion = ({ version }) => ( +