diff --git a/docs/app/Components/ComponentDoc/ComponentExample/ComponentExample.js b/docs/app/Components/ComponentDoc/ComponentExample/ComponentExample.js index a2529856b7..4a08eaf465 100644 --- a/docs/app/Components/ComponentDoc/ComponentExample/ComponentExample.js +++ b/docs/app/Components/ComponentDoc/ComponentExample/ComponentExample.js @@ -8,21 +8,15 @@ import { html } from 'js-beautify' import copyToClipboard from 'copy-to-clipboard' import { exampleContext, repoURL, scrollToAnchor } from 'docs/app/utils' -import { Divider, Grid, Header, Menu } from 'src' +import { Divider, Grid, Menu } from 'src' import Editor from 'docs/app/Components/Editor/Editor' import ComponentControls from '../ComponentControls' +import ComponentExampleTitle from './ComponentExampleTitle' const babelConfig = { presets: ['es2015', 'react', 'stage-1'], } -const titleStyle = { - margin: 0, -} -const descriptionStyle = { - maxWidth: '50rem', -} - const headerColumnStyle = { // provide room for absolutely positions toggle code icons minHeight: '4em', @@ -53,6 +47,7 @@ class ComponentExample extends Component { history: PropTypes.object.isRequired, location: PropTypes.object.isRequired, match: PropTypes.object.isRequired, + suiVersion: PropTypes.string, title: PropTypes.node, } @@ -374,7 +369,7 @@ class ComponentExample extends Component { } render() { - const { children, description, title } = this.props + const { children, description, suiVersion, title } = this.props const { controlsVisible, exampleElement, showCode, showHTML } = this.state const exampleStyle = {} @@ -392,8 +387,11 @@ class ComponentExample extends Component { > - {title &&
} - {description &&

{description}

} + ( +
+ {title && ( +
+ {title} + {suiVersion && ( +
+ )} + {description &&

{description}

} +
+) + +ComponentExampleTitle.propTypes = { + description: PropTypes.node, + title: PropTypes.node, + suiVersion: PropTypes.string, +} + +export default pure(ComponentExampleTitle) diff --git a/docs/app/Components/ComponentDoc/ShorthandExample.js b/docs/app/Components/ComponentDoc/ShorthandExample.js new file mode 100644 index 0000000000..1b67f9921a --- /dev/null +++ b/docs/app/Components/ComponentDoc/ShorthandExample.js @@ -0,0 +1,16 @@ +import PropTypes from 'prop-types' +import React from 'react' + +import ComponentExample from './ComponentExample' + +const ShorthandExample = ({ description, ...rest }) => + +ShorthandExample.propTypes = { + description: PropTypes.node, +} + +ShorthandExample.defaultProps = { + description: 'You can do the same using shorthands.', +} + +export default ShorthandExample diff --git a/docs/app/Examples/collections/Menu/Types/index.js b/docs/app/Examples/collections/Menu/Types/index.js index 1ea5b94f87..ca12fe5cf6 100644 --- a/docs/app/Examples/collections/Menu/Types/index.js +++ b/docs/app/Examples/collections/Menu/Types/index.js @@ -2,6 +2,7 @@ import React from 'react' import ExampleSection from 'docs/app/Components/ComponentDoc/ExampleSection' import ComponentExample from 'docs/app/Components/ComponentDoc/ComponentExample' +import ShorthandExample from 'docs/app/Components/ComponentDoc/ShorthandExample' // TODO: Add example with after it will be added @@ -12,10 +13,7 @@ const Types = () => ( description='A menu.' examplePath='collections/Menu/Types/MenuExampleBasic' /> - + ( @@ -20,11 +21,7 @@ const States = () => ( description='A cell or row may warn a user.' examplePath='collections/Table/States/TableExampleWarning' /> - + ( @@ -19,7 +21,7 @@ const ButtonGroupVariationsExamples = () => ( description='Groups can be formatted as icons.' examplePath='elements/Button/GroupVariations/ButtonExampleGroupIcon' /> - diff --git a/docs/app/Examples/elements/Label/Content/index.js b/docs/app/Examples/elements/Label/Content/index.js index 2fb6153e51..3d5d78a31d 100644 --- a/docs/app/Examples/elements/Label/Content/index.js +++ b/docs/app/Examples/elements/Label/Content/index.js @@ -2,6 +2,7 @@ import React from 'react' import ComponentExample from 'docs/app/Components/ComponentDoc/ComponentExample' import ExampleSection from 'docs/app/Components/ComponentDoc/ExampleSection' +import ShorthandExample from 'docs/app/Components/ComponentDoc/ShorthandExample' const LabelContent = () => ( @@ -16,20 +17,14 @@ const LabelContent = () => ( description='A label can include an icon' examplePath='elements/Label/Content/LabelExampleIcon' /> - + - + ( @@ -11,19 +12,13 @@ const ListTypes = () => ( description='A list groups related content' examplePath='elements/List/Types/ListExampleBasic' /> - + - + diff --git a/docs/app/Examples/elements/Loader/Types/index.js b/docs/app/Examples/elements/Loader/Types/index.js index ea360941ef..b656ee3e47 100644 --- a/docs/app/Examples/elements/Loader/Types/index.js +++ b/docs/app/Examples/elements/Loader/Types/index.js @@ -3,6 +3,7 @@ import { Message } from 'semantic-ui-react' import ComponentExample from 'docs/app/Components/ComponentDoc/ComponentExample' import ExampleSection from 'docs/app/Components/ComponentDoc/ExampleSection' +import ShorthandExample from 'docs/app/Components/ComponentDoc/ShorthandExample' const LoaderTypesExamples = () => ( @@ -21,10 +22,7 @@ const LoaderTypesExamples = () => ( description='A loader can contain text.' examplePath='elements/Loader/Types/LoaderExampleText' /> - + ) diff --git a/docs/app/Examples/elements/Step/Variations/index.js b/docs/app/Examples/elements/Step/Variations/index.js index 6c0a281995..fc04b34268 100644 --- a/docs/app/Examples/elements/Step/Variations/index.js +++ b/docs/app/Examples/elements/Step/Variations/index.js @@ -15,6 +15,7 @@ const StepVariationsExamples = () => ( title='Unstackable' description='A step can prevent itself from stacking on mobile.' examplePath='elements/Step/Variations/StepExampleUnstackable' + suiVersion='2.2.11' /> ( @@ -17,11 +18,11 @@ const CheckboxTypesExamples = () => ( description='A box for checking.' examplePath='modules/Checkbox/Types/CheckboxExampleCheckbox' /> - - diff --git a/docs/app/Examples/modules/Dropdown/Usage/index.js b/docs/app/Examples/modules/Dropdown/Usage/index.js index 25143eb24d..50ef11b701 100644 --- a/docs/app/Examples/modules/Dropdown/Usage/index.js +++ b/docs/app/Examples/modules/Dropdown/Usage/index.js @@ -1,6 +1,8 @@ import React from 'react' + import ComponentExample from 'docs/app/Components/ComponentDoc/ComponentExample' import ExampleSection from 'docs/app/Components/ComponentDoc/ExampleSection' +import ShorthandExample from 'docs/app/Components/ComponentDoc/ShorthandExample' const DropdownUsageExamples = () => ( @@ -76,7 +78,7 @@ const DropdownUsageExamples = () => ( description='A dropdown item can be rendered differently inside the menu.' examplePath='modules/Dropdown/Usage/DropdownExampleItemContent' /> - ( /> - ( title='Scrolling Content' description='A modal can use the entire size of the screen.' examplePath='modules/Modal/Variations/ModalExampleScrollingContent' + suiVersion='2.2.11' /> ( @@ -15,7 +16,7 @@ const SearchVariationsExamples = () => ( description='A search can have its results aligned to its left or right container edge.' examplePath='modules/Search/Variations/SearchExampleAligned' /> - ( @@ -19,7 +21,7 @@ const TabUsageExamples = () => ( description='You can capture the tab change event.' examplePath='modules/Tab/Usage/TabExampleOnTabChange' /> - ( - + + - + - + + - + + - - + + - + ) diff --git a/docs/app/HOC/index.js b/docs/app/HOC/index.js index f65e11d07d..072a6b5e7c 100644 --- a/docs/app/HOC/index.js +++ b/docs/app/HOC/index.js @@ -1,2 +1,3 @@ export neverUpdate from './neverUpdate' +export pure from './pure' export updateForKeys from './updateForKeys' diff --git a/docs/app/HOC/pure.js b/docs/app/HOC/pure.js new file mode 100644 index 0000000000..f0d68ab18f --- /dev/null +++ b/docs/app/HOC/pure.js @@ -0,0 +1,15 @@ +import React, { Component } from 'react' + +import { shallowEqual } from 'src/lib' + +const pure = ChildComponent => class extends Component { + shouldComponentUpdate(nextProps) { + return !shallowEqual(this.props, nextProps) + } + + render() { + return + } +} + +export default pure