diff --git a/docs/components/Layout/index.jsx b/docs/components/Layout/index.jsx index bd9f6fcc9..614263461 100644 --- a/docs/components/Layout/index.jsx +++ b/docs/components/Layout/index.jsx @@ -1,11 +1,14 @@ import _ from 'lodash'; import React from 'react'; import PropTypes from 'prop-types'; +import { PageTitle } from '../../../src'; + import Header from '../Header'; import Navigation from '../Navigation'; import Contributors from '../Contributors'; import SearchBar from '../SearchBar'; import SearchResultCard from '../SearchResultCard'; +import MigrationNote from '../MigrationNote'; import ButtonExample from '../../examples/ButtonExample'; import AlertInputExample from '../../examples/AlertInputExample'; @@ -56,8 +59,6 @@ import SplitPaneExample from '../../examples/SplitPaneExample'; import HoverDropdownMenuExample from '../../examples/HoverDropdownMenuExample'; import NavigationExample from '../../examples/NavigationExample'; -import { PageTitle } from '../../../src'; - import './styles.scss'; import '../../examples/styles.scss'; @@ -113,47 +114,44 @@ const componentsBySection = { const componentIndexForSearch = _.flatMap(componentsBySection); class PageLayout extends React.Component { - constructor(props) { - super(props); - this.state = { - page: 'buttons', - searchTerm: '', - searchResults: [], - }; - - this.navigateTo = newPage => { - if (newPage !== this.state.page) { - this.setState({ page: newPage }); - } - window.location.href = `${window.location.origin}${window.location.pathname}#${newPage}-example`; - }; - - this.filterComponents = searchTerm => { - const searchTermRegExp = new RegExp(searchTerm, 'i'); - return _(componentIndexForSearch) - .filter(val => searchTermRegExp.test(val)) - .sort() - .value(); - }; - - this.handleSearch = searchTerm => { - if (searchTerm.length === 0) { - this.clearSearch(); - } else { - this.setState({ - searchTerm, - searchResults: this.filterComponents(searchTerm), - }); - } - }; - - this.clearSearch = () => { + state = { + page: 'buttons', + searchTerm: '', + searchResults: [], + }; + + navigateTo = newPage => { + if (newPage !== this.state.page) { + this.setState({ page: newPage }); + } + window.location.href = `${window.location.origin}${window.location.pathname}#${newPage}-example`; + }; + + filterComponents = searchTerm => { + const searchTermRegExp = new RegExp(searchTerm, 'i'); + return _(componentIndexForSearch) + .filter(val => searchTermRegExp.test(val)) + .sort() + .value(); + }; + + handleSearch = searchTerm => { + if (searchTerm.length === 0) { + this.clearSearch(); + } else { this.setState({ - searchTerm: '', - searchResults: [], + searchTerm, + searchResults: this.filterComponents(searchTerm), }); - }; - } + } + }; + + clearSearch = () => { + this.setState({ + searchTerm: '', + searchResults: [], + }); + }; render() { return ( @@ -173,6 +171,7 @@ class PageLayout extends React.Component { )} + diff --git a/docs/components/Layout/styles.scss b/docs/components/Layout/styles.scss index 568af27e4..40a6c67b5 100644 --- a/docs/components/Layout/styles.scss +++ b/docs/components/Layout/styles.scss @@ -29,12 +29,12 @@ body { flex: 1; > .pagetitle-component { - margin-bottom: $spacing-etalon; + margin: $spacing-etalon auto; padding-left: 0; + } - &:not(:first-child) { - margin-top: ($spacing-etalon * 4); - } + > .migration-docs { + font-size: $font-size-header; } } diff --git a/docs/components/MigrationNote/index.jsx b/docs/components/MigrationNote/index.jsx new file mode 100644 index 000000000..2b8944abe --- /dev/null +++ b/docs/components/MigrationNote/index.jsx @@ -0,0 +1,129 @@ +import React from 'react'; +import Collapse from 'react-bootstrap/lib/Collapse'; +import SyntaxHighlighter, { registerLanguage } from 'react-syntax-highlighter/prism-light'; +import jsx from 'react-syntax-highlighter/languages/prism/jsx'; +import coy from 'react-syntax-highlighter/styles/prism/coy'; + +import { Button } from '../../../src'; + +registerLanguage('jsx', jsx); + +class MigrationNote extends React.Component { + state = { + showModal: false, + }; + + openCollapse = () => { + this.setState(prev => ({ showModal: !prev.showModal })); + }; + + render() { + return ( + <> + + +
+

Migration Guide

+
+

Popover Component

+

+ The {``} component can be themed by providing one of the following values to the theme{' '} + prop:{` `} + ['light', 'dark', 'warn', 'error']. +

+

+ For more information check the example: Popover Example +

+
+

Accordion Component

+

The accordion component has been rewritten due to performance concerns.

+

+ The new component no longer accepts the 'panels' prop. +

+ Old way: + + {` + +
  • + +
  • +
  • + +
  • + + ), + }, + ]} + onPanelClick={this.toggleAccordionPanel} + /> + `} +
    + New way: Each panel should be provided as a child of the Accordion component. + + {` + + +
      +
    • + +
    • +
    • + +
    • +
    +
    +
    + `} +
    +

    Tabs Component

    +

    This component has been rewritten due to some React issues.

    +

    Also Adslot-ui lib has deprecated Tabs and Tab from react-bootstrap

    +

    + For more information check the example: Tab Example +

    +
    +

    Checkbox Component

    +

    + This component will support 3 states CHECKED, PARTIAL CHECKED AND NON-CHECKED from version 27{' '} +

    +

    Also the onChange function has changed

    + + {` + From: onChange = (event, name) => {...} + To: onChange = (nextCheckState, name, value) => {...} + `} + +

    The nextCheckState will be:

    + + {` + true => false false => true 'partial' => false + `} + +

    + For more information check the example: Checkbox Example +

    +
    +
    + + ); + } +} + +export default MigrationNote; diff --git a/docs/examples/TabExample.jsx b/docs/examples/TabExample.jsx index f4ab0b731..86a91af58 100644 --- a/docs/examples/TabExample.jsx +++ b/docs/examples/TabExample.jsx @@ -120,6 +120,7 @@ const exampleProps = { { propType: 'onSelect', type: 'func', + note: `(selectedTabKey) => {...}`, }, { propType: 'id',