From 1ad50f536174196bfebdd6e9d75126d602ab67ee Mon Sep 17 00:00:00 2001 From: Tobias Date: Fri, 23 Nov 2018 09:36:57 +0100 Subject: [PATCH] remove the Gatsby flickering artifact by using PureComponent --- .circleci/config.yml | 12 ++++--- .../dnb-design-system-portal/gatsby-config.js | 34 +++++++++---------- .../dnb-design-system-portal/package.json | 2 +- .../scripts/deploy.js | 2 +- .../dnb-design-system-portal/src/pages/404.js | 4 +-- .../src/pages/index.js | 4 +-- .../pages/uilib/demos/example-app-1/index.js | 4 +-- .../uilib/demos/example-app-2/LoanSausage.js | 6 ++-- .../pages/uilib/demos/example-app-2/index.js | 4 +-- .../src/shared/inlineTags/Table.js | 4 +-- .../src/shared/menu/Card.js | 4 +-- .../src/shared/menu/MainMenu.js | 4 +-- .../src/shared/menu/SidebarMenu.js | 4 +-- .../src/shared/menu/StickyMenuBar.js | 4 +-- .../src/shared/parts/Layout.js | 4 +-- .../src/shared/parts/Markdown.js | 8 ++--- .../src/shared/parts/icons/ListAllIcons.js | 4 +-- .../src/shared/parts/uilib/Code.js | 6 ++-- .../src/shared/parts/uilib/ItemWrapper.js | 4 +-- .../src/templates/mdx.js | 24 +++++++++---- .../src/uilib/components/demos/Button.js | 4 +-- .../src/uilib/components/demos/Dropdown.js | 4 +-- .../src/uilib/components/demos/FormLabel.js | 4 +-- .../src/uilib/components/demos/Icon.js | 4 +-- .../src/uilib/components/demos/Input.js | 4 +-- .../src/uilib/components/demos/InputMasked.js | 4 +-- .../src/uilib/components/demos/LineTitle.js | 4 +-- .../src/uilib/components/demos/Logo.js | 4 +-- .../src/uilib/components/demos/Modal.js | 4 +-- .../uilib/components/demos/Notification.js | 4 +-- .../src/uilib/components/demos/Slider.js | 4 +-- .../src/uilib/components/demos/Switch.js | 4 +-- .../src/uilib/components/demos/Tabs.js | 4 +-- .../src/uilib/components/demos/Template.js | 4 +-- .../src/uilib/patterns/demos/ActionNav.js | 4 +-- .../uilib/patterns/demos/DescriptionList.js | 4 +-- .../patterns/demos/FieldsetDescription.js | 4 +-- .../src/uilib/patterns/demos/Footer.js | 4 +-- .../src/uilib/patterns/demos/Form.js | 4 +-- .../src/uilib/patterns/demos/FormSummary.js | 4 +-- .../src/uilib/patterns/demos/Grid.js | 4 +-- .../src/uilib/patterns/demos/HelperClasses.js | 4 +-- .../src/uilib/patterns/demos/MainNav.js | 4 +-- .../src/uilib/patterns/demos/RangeSlider.js | 4 +-- .../src/uilib/patterns/demos/StepIndicator.js | 4 +-- .../src/uilib/patterns/demos/SummaryTable.js | 4 +-- .../src/uilib/patterns/demos/Template.js | 4 +-- .../src/uilib/patterns/demos/Typography.js | 4 +-- .../src/uilib/patterns/demos/ViewTitle.js | 4 +-- .../src/components/button/Example.js | 4 +-- .../src/components/dropdown/Example.js | 4 +-- .../src/components/form-label/Example.js | 4 +-- .../dnb-ui-lib/src/components/icon/Example.js | 4 +-- .../src/components/input-masked/Example.js | 4 +-- .../src/components/input/Example.js | 4 +-- .../src/components/line-title/Example.js | 4 +-- .../dnb-ui-lib/src/components/logo/Example.js | 4 +-- .../src/components/modal/Example.js | 4 +-- .../src/components/notification/Example.js | 4 +-- .../src/components/slider/Example.js | 6 ++-- .../src/components/switch/Example.js | 6 ++-- .../dnb-ui-lib/src/components/tabs/Example.js | 4 +-- .../src/patterns/action-nav/ActionNav.js | 4 +-- .../src/patterns/action-nav/Example.js | 4 +-- .../description-list/DescriptionList.js | 4 +-- .../src/patterns/description-list/Example.js | 4 +-- .../patterns/fieldset-description/Example.js | 4 +-- .../FieldsetDescription.js | 4 +-- .../dnb-ui-lib/src/patterns/footer/Example.js | 4 +-- .../dnb-ui-lib/src/patterns/footer/Footer.js | 4 +-- .../src/patterns/form-summary/Example.js | 4 +-- .../src/patterns/form-summary/FormSummary.js | 4 +-- .../dnb-ui-lib/src/patterns/form/Example.js | 4 +-- packages/dnb-ui-lib/src/patterns/form/Form.js | 4 +-- .../dnb-ui-lib/src/patterns/grid/Example.js | 4 +-- packages/dnb-ui-lib/src/patterns/grid/Grid.js | 4 +-- .../src/patterns/helper-classes/Example.js | 4 +-- .../patterns/helper-classes/HelperClasses.js | 4 +-- .../src/patterns/main-nav/Example.js | 4 +-- .../src/patterns/main-nav/MainNav.js | 4 +-- .../src/patterns/range-slider/Example.js | 4 +-- .../src/patterns/range-slider/RangeSlider.js | 4 +-- .../src/patterns/step-indicator/Example.js | 4 +-- .../patterns/step-indicator/StepIndicator.js | 6 ++-- .../src/patterns/summary-table/Example.js | 4 +-- .../patterns/summary-table/SummaryTable.js | 4 +-- .../src/patterns/typography/Example.js | 4 +-- .../src/patterns/typography/Typography.js | 4 +-- .../src/patterns/view-title/Example.js | 4 +-- .../src/patterns/view-title/ViewTitle.js | 4 +-- packages/dnb-ui-lib/stories/components.js | 6 ++-- packages/examples/example-react/src/App.jsx | 4 +-- yarn.lock | 34 ++++--------------- 93 files changed, 231 insertions(+), 241 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5960b3a64cc..d8d854a87b0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -25,19 +25,19 @@ jobs: - ~/.cache/yarn - run: - name: prepublish + name: Prepublish the ui-lib command: yarn prepublish-ci - run: - name: build + name: Build the portal command: yarn build-ci - run: - name: deploy + name: Deploy the portal command: yarn deploy-ci - run: - name: release on NPM + name: Release on NPM command: yarn publish-ci test: @@ -74,10 +74,12 @@ workflows: branches: ignore: - master + - /.*rc-.*|^rc\// + - /.*wip-.*|^wip\// - gh-pages - deploy: filters: branches: only: - master - - /rc-.*/ + - /.*rc-.*|^rc\// diff --git a/packages/dnb-design-system-portal/gatsby-config.js b/packages/dnb-design-system-portal/gatsby-config.js index 171412ebed3..35f383b40c0 100644 --- a/packages/dnb-design-system-portal/gatsby-config.js +++ b/packages/dnb-design-system-portal/gatsby-config.js @@ -15,24 +15,9 @@ module.exports = { }, plugins: [ 'gatsby-plugin-sharp', - 'gatsby-plugin-offline', + // 'gatsby-plugin-offline', 'gatsby-plugin-catch-links', 'gatsby-plugin-react-helmet', - 'gatsby-plugin-emotion', - 'gatsby-plugin-sass', - { - resolve: 'gatsby-plugin-postcss', - options: { - postCssPlugins: [ - require('postcss-calc'), - require('postcss-custom-properties'), - require('postcss-preset-env')({ stage: 0 }), - require('autoprefixer')({ - browsers: ['last 1 versions', 'explorer >= 11'] - }) - ] - } - }, { resolve: 'gatsby-mdx', options: { @@ -57,6 +42,21 @@ module.exports = { path: `${__dirname}/src/pages`, name: 'pages' } - } + }, + 'gatsby-plugin-sass', + { + resolve: 'gatsby-plugin-postcss', + options: { + postCssPlugins: [ + require('postcss-calc'), + require('postcss-custom-properties'), + require('postcss-preset-env')({ stage: 0 }), + require('autoprefixer')({ + browsers: ['last 1 versions', 'explorer >= 11'] + }) + ] + } + }, + 'gatsby-plugin-emotion' ] } diff --git a/packages/dnb-design-system-portal/package.json b/packages/dnb-design-system-portal/package.json index 188912d8b29..9fbe8be76b0 100644 --- a/packages/dnb-design-system-portal/package.json +++ b/packages/dnb-design-system-portal/package.json @@ -80,7 +80,7 @@ "eslint-plugin-jsx-a11y": "^6.1.2", "eslint-plugin-react": "^7.11.1", "fs-extra": "^7.0.1", - "gatsby": "^2.0.54", + "gatsby": "^2.0.55", "gatsby-link": "^2.0.6", "gatsby-mdx": "^0.2.0", "gatsby-plugin-catch-links": "^2.0.8", diff --git a/packages/dnb-design-system-portal/scripts/deploy.js b/packages/dnb-design-system-portal/scripts/deploy.js index e7e7d1a384c..9c77f9208ce 100644 --- a/packages/dnb-design-system-portal/scripts/deploy.js +++ b/packages/dnb-design-system-portal/scripts/deploy.js @@ -42,7 +42,7 @@ const run = () => { if (error) { log.fail(`Failed to deploy! \n${error.message}`) } - log.succeed(`Deployed successfully ${currentVersion}!`) + log.succeed(`Deployed successfully, version ${currentVersion}!`) } ) } diff --git a/packages/dnb-design-system-portal/src/pages/404.js b/packages/dnb-design-system-portal/src/pages/404.js index 71a60e5f458..c11281cd2bf 100644 --- a/packages/dnb-design-system-portal/src/pages/404.js +++ b/packages/dnb-design-system-portal/src/pages/404.js @@ -3,11 +3,11 @@ * */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import styled from 'react-emotion' -export default class PageNotFound extends Component { +export default class PageNotFound extends PureComponent { static propTypes = { location: PropTypes.object.isRequired } diff --git a/packages/dnb-design-system-portal/src/pages/index.js b/packages/dnb-design-system-portal/src/pages/index.js index bf06ef2f496..c9cb2eaf3cf 100644 --- a/packages/dnb-design-system-portal/src/pages/index.js +++ b/packages/dnb-design-system-portal/src/pages/index.js @@ -3,7 +3,7 @@ * */ -import React, { Component, Fragment } from 'react' +import React, { PureComponent, Fragment } from 'react' import StickyMenuBar from '../shared/menu/StickyMenuBar' import MainMenu from '../shared/menu/MainMenu' @@ -12,7 +12,7 @@ import 'dnb-ui-lib/src/style/patterns' // import ony patterns import 'dnb-ui-lib/src/style' // import both all components and the defualt theme // react component -export default class App extends Component { +export default class App extends PureComponent { render() { return ( diff --git a/packages/dnb-design-system-portal/src/pages/uilib/demos/example-app-1/index.js b/packages/dnb-design-system-portal/src/pages/uilib/demos/example-app-1/index.js index 8ce87e0ce23..1a9b8d171ab 100644 --- a/packages/dnb-design-system-portal/src/pages/uilib/demos/example-app-1/index.js +++ b/packages/dnb-design-system-portal/src/pages/uilib/demos/example-app-1/index.js @@ -3,7 +3,7 @@ * */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import { css } from 'react-emotion' import Head from 'react-helmet' import dnb, { @@ -29,7 +29,7 @@ const style = css` background: white; ` -export default class ExampleAppPage extends Component { +export default class ExampleAppPage extends PureComponent { componentDidMount() { dnb.enableWebComponents() } diff --git a/packages/dnb-design-system-portal/src/pages/uilib/demos/example-app-2/LoanSausage.js b/packages/dnb-design-system-portal/src/pages/uilib/demos/example-app-2/LoanSausage.js index 4e01927e3b1..5bffe7a02e5 100644 --- a/packages/dnb-design-system-portal/src/pages/uilib/demos/example-app-2/LoanSausage.js +++ b/packages/dnb-design-system-portal/src/pages/uilib/demos/example-app-2/LoanSausage.js @@ -3,7 +3,7 @@ * */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import { css } from 'react-emotion' import { Modal } from 'dnb-ui-lib/src' @@ -92,7 +92,7 @@ const style = css` } ` -export default class LoanSausage extends Component { +export default class LoanSausage extends PureComponent { static propTypes = { equity: PropTypes.string.isRequired, currency: PropTypes.string.isRequired, @@ -167,7 +167,7 @@ export default class LoanSausage extends Component { } } -class SausageItem extends Component { +class SausageItem extends PureComponent { static propTypes = { title: PropTypes.string.isRequired, percentage: PropTypes.string.isRequired diff --git a/packages/dnb-design-system-portal/src/pages/uilib/demos/example-app-2/index.js b/packages/dnb-design-system-portal/src/pages/uilib/demos/example-app-2/index.js index 3e695c7d655..e989d40c688 100644 --- a/packages/dnb-design-system-portal/src/pages/uilib/demos/example-app-2/index.js +++ b/packages/dnb-design-system-portal/src/pages/uilib/demos/example-app-2/index.js @@ -3,7 +3,7 @@ * */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import { css } from 'react-emotion' import Head from 'react-helmet' import dnb, { @@ -27,7 +27,7 @@ const style = css` background: white; ` -export default class ExampleAppPage extends Component { +export default class ExampleAppPage extends PureComponent { componentDidMount() { dnb.enableWebComponents() } diff --git a/packages/dnb-design-system-portal/src/shared/inlineTags/Table.js b/packages/dnb-design-system-portal/src/shared/inlineTags/Table.js index 3407d09b238..8e8473575f2 100644 --- a/packages/dnb-design-system-portal/src/shared/inlineTags/Table.js +++ b/packages/dnb-design-system-portal/src/shared/inlineTags/Table.js @@ -3,11 +3,11 @@ * */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import Color from 'color' -export default class Table extends Component { +export default class Table extends PureComponent { static propTypes = { children: PropTypes.node.isRequired } diff --git a/packages/dnb-design-system-portal/src/shared/menu/Card.js b/packages/dnb-design-system-portal/src/shared/menu/Card.js index b8880dcd787..056c44e532e 100644 --- a/packages/dnb-design-system-portal/src/shared/menu/Card.js +++ b/packages/dnb-design-system-portal/src/shared/menu/Card.js @@ -3,7 +3,7 @@ * */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import Link from 'gatsby-link' import styled, { css, cx } from 'react-emotion' @@ -91,7 +91,7 @@ const Box = styled.div` flex-direction: column; ` -export default class Card extends Component { +export default class Card extends PureComponent { static propTypes = { url: PropTypes.string.isRequired, customStyle: PropTypes.string, diff --git a/packages/dnb-design-system-portal/src/shared/menu/MainMenu.js b/packages/dnb-design-system-portal/src/shared/menu/MainMenu.js index 636351c4faf..5add4f279ea 100644 --- a/packages/dnb-design-system-portal/src/shared/menu/MainMenu.js +++ b/packages/dnb-design-system-portal/src/shared/menu/MainMenu.js @@ -3,7 +3,7 @@ * */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import { injectGlobal, css } from 'react-emotion' import classnames from 'classnames' @@ -94,7 +94,7 @@ const toolbarStyle = css` background-color: #fff; ` -export default class MainMenu extends Component { +export default class MainMenu extends PureComponent { static propTypes = { setAsOverlay: PropTypes.bool, enableOverlay: PropTypes.bool, diff --git a/packages/dnb-design-system-portal/src/shared/menu/SidebarMenu.js b/packages/dnb-design-system-portal/src/shared/menu/SidebarMenu.js index fc865860b1a..e2b1af5004d 100644 --- a/packages/dnb-design-system-portal/src/shared/menu/SidebarMenu.js +++ b/packages/dnb-design-system-portal/src/shared/menu/SidebarMenu.js @@ -7,12 +7,12 @@ import { StaticQuery, graphql } from 'gatsby' import Link from '../parts/Link' import PropTypes from 'prop-types' -import React from 'react' +import React, { PureComponent } from 'react' import styled, { injectGlobal, cx } from 'react-emotion' const showAlwaysMenuItems = [] // like "uilib" som someting like that -export default class SidebarLayout extends React.Component { +export default class SidebarLayout extends PureComponent { static propTypes = { location: PropTypes.object.isRequired, showAll: PropTypes.bool diff --git a/packages/dnb-design-system-portal/src/shared/menu/StickyMenuBar.js b/packages/dnb-design-system-portal/src/shared/menu/StickyMenuBar.js index a335aac31c6..6c93cb4589e 100644 --- a/packages/dnb-design-system-portal/src/shared/menu/StickyMenuBar.js +++ b/packages/dnb-design-system-portal/src/shared/menu/StickyMenuBar.js @@ -3,7 +3,7 @@ * */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import { css, injectGlobal } from 'react-emotion' // import Head from 'react-helmet' @@ -11,7 +11,7 @@ import MainMenu from './MainMenu' import gridSvg from '../../../static/assets/images/grid-32x32.svg' import { FormLabel, Switch, Logo } from 'dnb-ui-lib/src' -export default class StickyMenuBar extends Component { +export default class StickyMenuBar extends PureComponent { state = { showOverlayMenu: false, showGrid: null diff --git a/packages/dnb-design-system-portal/src/shared/parts/Layout.js b/packages/dnb-design-system-portal/src/shared/parts/Layout.js index d26ce7300bb..b629d8cbf65 100644 --- a/packages/dnb-design-system-portal/src/shared/parts/Layout.js +++ b/packages/dnb-design-system-portal/src/shared/parts/Layout.js @@ -9,7 +9,7 @@ import 'dnb-ui-lib/src/style' // import both all components and the defualt them // import 'dnb-ui-lib/src/style/themes/dnb-theme-open-banking.scss' import { pageFocus } from 'dnb-ui-lib/src/shared/tools' -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import { Link } from 'gatsby' import PropTypes from 'prop-types' @@ -19,7 +19,7 @@ import { markdownStyle } from './Markdown' import styled, { cx } from 'react-emotion' import { buildVersion } from '../../../package.json' -class Layout extends Component { +class Layout extends PureComponent { static propTypes = { children: PropTypes.node.isRequired, location: PropTypes.object.isRequired, diff --git a/packages/dnb-design-system-portal/src/shared/parts/Markdown.js b/packages/dnb-design-system-portal/src/shared/parts/Markdown.js index c0b5ff56c97..41007efa776 100644 --- a/packages/dnb-design-system-portal/src/shared/parts/Markdown.js +++ b/packages/dnb-design-system-portal/src/shared/parts/Markdown.js @@ -3,7 +3,7 @@ * */ -import React, { Component, Fragment } from 'react' +import React, { PureComponent, Fragment } from 'react' import PropTypes from 'prop-types' import dnb from 'dnb-ui-lib/src' @@ -11,7 +11,7 @@ import portalStyle from './PortalStyle' // import { CodeRenderer } from './Code' // import ReactMarkdown from 'react-markdown' -// export default class Markdown extends Component { +// export default class Markdown extends PureComponent { // static propTypes = { // children: PropTypes.string.isRequired // } @@ -35,7 +35,7 @@ import portalStyle from './PortalStyle' // } // } -export class Html extends Component { +export class Html extends PureComponent { static propTypes = { children: PropTypes.node, value: PropTypes.string @@ -79,7 +79,7 @@ export class Html extends Component { } } -// export class Script extends Component { +// export class Script extends PureComponent { // static propTypes = { // children: PropTypes.node, // value: PropTypes.string diff --git a/packages/dnb-design-system-portal/src/shared/parts/icons/ListAllIcons.js b/packages/dnb-design-system-portal/src/shared/parts/icons/ListAllIcons.js index 8d3297a9ecd..9a7b10794b6 100644 --- a/packages/dnb-design-system-portal/src/shared/parts/icons/ListAllIcons.js +++ b/packages/dnb-design-system-portal/src/shared/parts/icons/ListAllIcons.js @@ -2,13 +2,13 @@ * List all the Icons available */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import * as PrimaryIcons from 'dnb-ui-lib/src/icons/primary_icons' import * as SecondaryIcons from 'dnb-ui-lib/src/icons/secondary_icons' import styled from 'react-emotion' -export default class Icons extends Component { +export default class Icons extends PureComponent { state = { iconsToRender: [] } static propTypes = { type: PropTypes.string diff --git a/packages/dnb-design-system-portal/src/shared/parts/uilib/Code.js b/packages/dnb-design-system-portal/src/shared/parts/uilib/Code.js index 8f135aa8b9d..ed8523ff1ad 100644 --- a/packages/dnb-design-system-portal/src/shared/parts/uilib/Code.js +++ b/packages/dnb-design-system-portal/src/shared/parts/uilib/Code.js @@ -3,7 +3,7 @@ * */ -import React, { Component, Fragment } from 'react' +import React, { PureComponent, Fragment } from 'react' import Beautifier from './code_beautifier' import PropTypes from 'prop-types' @@ -15,7 +15,7 @@ import pretty from 'pretty' // https://www.npmjs.com/package/pretty // import plugins from 'prettier/parser-parse5' import CodeBlock from '../../inlineTags/CodeBlock' -export default class Code extends Component { +export default class Code extends PureComponent { static propTypes = { language: PropTypes.string, raw: PropTypes.string, @@ -94,7 +94,7 @@ export default class Code extends Component { } } -export class CodeRenderer extends Component { +export class CodeRenderer extends PureComponent { static propTypes = { language: PropTypes.string, children: PropTypes.oneOfType([ diff --git a/packages/dnb-design-system-portal/src/shared/parts/uilib/ItemWrapper.js b/packages/dnb-design-system-portal/src/shared/parts/uilib/ItemWrapper.js index 96fafb0e471..4a64f0a2bd6 100644 --- a/packages/dnb-design-system-portal/src/shared/parts/uilib/ItemWrapper.js +++ b/packages/dnb-design-system-portal/src/shared/parts/uilib/ItemWrapper.js @@ -5,7 +5,7 @@ import { Button, Tabs } from 'dnb-ui-lib/src' import Code, { CodeRenderer } from './Code' -import React, { Component, Fragment } from 'react' +import React, { PureComponent, Fragment } from 'react' import { CloseButton } from 'dnb-ui-lib/src/components/modal' import Link from 'gatsby-link' @@ -45,7 +45,7 @@ const tabsWrapperStyle = css` } ` -class ComponentItemWrapper extends Component { +class ComponentItemWrapper extends PureComponent { static propTypes = { ExampleCode: PropTypes.string, Description: PropTypes.func.isRequired, diff --git a/packages/dnb-design-system-portal/src/templates/mdx.js b/packages/dnb-design-system-portal/src/templates/mdx.js index 38c6be93343..00c07e65d3c 100644 --- a/packages/dnb-design-system-portal/src/templates/mdx.js +++ b/packages/dnb-design-system-portal/src/templates/mdx.js @@ -2,7 +2,8 @@ * Mdx Template */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' +import PropTypes from 'prop-types' import Head from 'react-helmet' import Layout from '../shared/parts/Layout' @@ -11,7 +12,7 @@ import MDXRenderer from 'gatsby-mdx/mdx-renderer' import { graphql, withPrefix } from 'gatsby' import inlineTags from '../shared/inlineTags' -export default class MdxTemplate extends Component { +export default class MdxTemplate extends PureComponent { render() { const { data: { @@ -30,18 +31,27 @@ export default class MdxTemplate extends Component { return ( + + {title} + + + - - {title} - - - {code.body} ) } } +MdxTemplate.propTypes = { + data: PropTypes.shape({ + mdx: PropTypes.shape({ + code: PropTypes.shape({ + body: PropTypes.string.isRequired + }).isRequired + }).isRequired + }).isRequired +} export const pageQuery = graphql` query($id: String!) { diff --git a/packages/dnb-design-system-portal/src/uilib/components/demos/Button.js b/packages/dnb-design-system-portal/src/uilib/components/demos/Button.js index 1abd3ddae5f..8efb7e7a1ce 100644 --- a/packages/dnb-design-system-portal/src/uilib/components/demos/Button.js +++ b/packages/dnb-design-system-portal/src/uilib/components/demos/Button.js @@ -7,7 +7,7 @@ * */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import ItemWrapper from '../../../shared/parts/uilib/ItemWrapper' import DemoComponent, { @@ -17,7 +17,7 @@ import Description from 'dnb-ui-lib/src/components/button/description.md' import Details from 'dnb-ui-lib/src/components/button/details.md' import ExampleCode from 'raw-loader!../examples/Button.txt' -export default class ButtonDemo extends Component { +export default class ButtonDemo extends PureComponent { static propTypes = { title: PropTypes.string, id: PropTypes.string, diff --git a/packages/dnb-design-system-portal/src/uilib/components/demos/Dropdown.js b/packages/dnb-design-system-portal/src/uilib/components/demos/Dropdown.js index 47cc28bd5d9..163a34f12d1 100644 --- a/packages/dnb-design-system-portal/src/uilib/components/demos/Dropdown.js +++ b/packages/dnb-design-system-portal/src/uilib/components/demos/Dropdown.js @@ -7,7 +7,7 @@ * */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import ItemWrapper from '../../../shared/parts/uilib/ItemWrapper' import DemoComponent, { @@ -17,7 +17,7 @@ import Description from 'dnb-ui-lib/src/components/dropdown/description.md' import Details from 'dnb-ui-lib/src/components/dropdown/details.md' import ExampleCode from 'raw-loader!../examples/Dropdown.txt' -export default class DropdownDemo extends Component { +export default class DropdownDemo extends PureComponent { static propTypes = { title: PropTypes.string, id: PropTypes.string, diff --git a/packages/dnb-design-system-portal/src/uilib/components/demos/FormLabel.js b/packages/dnb-design-system-portal/src/uilib/components/demos/FormLabel.js index 358e3e6ae4d..31d3c077d63 100644 --- a/packages/dnb-design-system-portal/src/uilib/components/demos/FormLabel.js +++ b/packages/dnb-design-system-portal/src/uilib/components/demos/FormLabel.js @@ -7,7 +7,7 @@ * */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import ItemWrapper from '../../../shared/parts/uilib/ItemWrapper' import DemoComponent, { @@ -17,7 +17,7 @@ import Description from 'dnb-ui-lib/src/components/form-label/description.md' import Details from 'dnb-ui-lib/src/components/form-label/details.md' import ExampleCode from 'raw-loader!../examples/FormLabel.txt' -export default class FormLabelDemo extends Component { +export default class FormLabelDemo extends PureComponent { static propTypes = { title: PropTypes.string, id: PropTypes.string, diff --git a/packages/dnb-design-system-portal/src/uilib/components/demos/Icon.js b/packages/dnb-design-system-portal/src/uilib/components/demos/Icon.js index a48c32a6e20..78f4630cbc3 100644 --- a/packages/dnb-design-system-portal/src/uilib/components/demos/Icon.js +++ b/packages/dnb-design-system-portal/src/uilib/components/demos/Icon.js @@ -7,7 +7,7 @@ * */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import ItemWrapper from '../../../shared/parts/uilib/ItemWrapper' import DemoComponent, { @@ -17,7 +17,7 @@ import Description from 'dnb-ui-lib/src/components/icon/description.md' import Details from 'dnb-ui-lib/src/components/icon/details.md' import ExampleCode from 'raw-loader!../examples/Icon.txt' -export default class IconDemo extends Component { +export default class IconDemo extends PureComponent { static propTypes = { title: PropTypes.string, id: PropTypes.string, diff --git a/packages/dnb-design-system-portal/src/uilib/components/demos/Input.js b/packages/dnb-design-system-portal/src/uilib/components/demos/Input.js index bb7bdb8f851..4c679659159 100644 --- a/packages/dnb-design-system-portal/src/uilib/components/demos/Input.js +++ b/packages/dnb-design-system-portal/src/uilib/components/demos/Input.js @@ -7,7 +7,7 @@ * */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import ItemWrapper from '../../../shared/parts/uilib/ItemWrapper' import DemoComponent, { @@ -17,7 +17,7 @@ import Description from 'dnb-ui-lib/src/components/input/description.md' import Details from 'dnb-ui-lib/src/components/input/details.md' import ExampleCode from 'raw-loader!../examples/Input.txt' -export default class InputDemo extends Component { +export default class InputDemo extends PureComponent { static propTypes = { title: PropTypes.string, id: PropTypes.string, diff --git a/packages/dnb-design-system-portal/src/uilib/components/demos/InputMasked.js b/packages/dnb-design-system-portal/src/uilib/components/demos/InputMasked.js index 71bb8a4794b..87d86bcd34c 100644 --- a/packages/dnb-design-system-portal/src/uilib/components/demos/InputMasked.js +++ b/packages/dnb-design-system-portal/src/uilib/components/demos/InputMasked.js @@ -7,7 +7,7 @@ * */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import ItemWrapper from '../../../shared/parts/uilib/ItemWrapper' import DemoComponent, { @@ -17,7 +17,7 @@ import Description from 'dnb-ui-lib/src/components/input-masked/description.md' import Details from 'dnb-ui-lib/src/components/input-masked/details.md' import ExampleCode from 'raw-loader!../examples/InputMasked.txt' -export default class InputMaskedDemo extends Component { +export default class InputMaskedDemo extends PureComponent { static propTypes = { title: PropTypes.string, id: PropTypes.string, diff --git a/packages/dnb-design-system-portal/src/uilib/components/demos/LineTitle.js b/packages/dnb-design-system-portal/src/uilib/components/demos/LineTitle.js index c7d8494e071..5070f9d4112 100644 --- a/packages/dnb-design-system-portal/src/uilib/components/demos/LineTitle.js +++ b/packages/dnb-design-system-portal/src/uilib/components/demos/LineTitle.js @@ -7,7 +7,7 @@ * */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import ItemWrapper from '../../../shared/parts/uilib/ItemWrapper' import DemoComponent, { @@ -17,7 +17,7 @@ import Description from 'dnb-ui-lib/src/components/line-title/description.md' import Details from 'dnb-ui-lib/src/components/line-title/details.md' import ExampleCode from 'raw-loader!../examples/LineTitle.txt' -export default class LineTitleDemo extends Component { +export default class LineTitleDemo extends PureComponent { static propTypes = { title: PropTypes.string, id: PropTypes.string, diff --git a/packages/dnb-design-system-portal/src/uilib/components/demos/Logo.js b/packages/dnb-design-system-portal/src/uilib/components/demos/Logo.js index ca9dec271ba..0c7213cff0a 100644 --- a/packages/dnb-design-system-portal/src/uilib/components/demos/Logo.js +++ b/packages/dnb-design-system-portal/src/uilib/components/demos/Logo.js @@ -7,7 +7,7 @@ * */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import ItemWrapper from '../../../shared/parts/uilib/ItemWrapper' import DemoComponent, { @@ -17,7 +17,7 @@ import Description from 'dnb-ui-lib/src/components/logo/description.md' import Details from 'dnb-ui-lib/src/components/logo/details.md' import ExampleCode from 'raw-loader!../examples/Logo.txt' -export default class LogoDemo extends Component { +export default class LogoDemo extends PureComponent { static propTypes = { title: PropTypes.string, id: PropTypes.string, diff --git a/packages/dnb-design-system-portal/src/uilib/components/demos/Modal.js b/packages/dnb-design-system-portal/src/uilib/components/demos/Modal.js index 5a53a1d21dc..3ce1e80b0a1 100644 --- a/packages/dnb-design-system-portal/src/uilib/components/demos/Modal.js +++ b/packages/dnb-design-system-portal/src/uilib/components/demos/Modal.js @@ -7,7 +7,7 @@ * */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import ItemWrapper from '../../../shared/parts/uilib/ItemWrapper' import DemoComponent, { @@ -17,7 +17,7 @@ import Description from 'dnb-ui-lib/src/components/modal/description.md' import Details from 'dnb-ui-lib/src/components/modal/details.md' import ExampleCode from 'raw-loader!../examples/Modal.txt' -export default class ModalDemo extends Component { +export default class ModalDemo extends PureComponent { static propTypes = { title: PropTypes.string, id: PropTypes.string, diff --git a/packages/dnb-design-system-portal/src/uilib/components/demos/Notification.js b/packages/dnb-design-system-portal/src/uilib/components/demos/Notification.js index 93e08c78231..888bfeff02c 100644 --- a/packages/dnb-design-system-portal/src/uilib/components/demos/Notification.js +++ b/packages/dnb-design-system-portal/src/uilib/components/demos/Notification.js @@ -7,7 +7,7 @@ * */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import ItemWrapper from '../../../shared/parts/uilib/ItemWrapper' import DemoComponent, { @@ -17,7 +17,7 @@ import Description from 'dnb-ui-lib/src/components/notification/description.md' import Details from 'dnb-ui-lib/src/components/notification/details.md' import ExampleCode from 'raw-loader!../examples/Notification.txt' -export default class NotificationDemo extends Component { +export default class NotificationDemo extends PureComponent { static propTypes = { title: PropTypes.string, id: PropTypes.string, diff --git a/packages/dnb-design-system-portal/src/uilib/components/demos/Slider.js b/packages/dnb-design-system-portal/src/uilib/components/demos/Slider.js index b96eaed1693..32675b9e52a 100644 --- a/packages/dnb-design-system-portal/src/uilib/components/demos/Slider.js +++ b/packages/dnb-design-system-portal/src/uilib/components/demos/Slider.js @@ -7,7 +7,7 @@ * */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import ItemWrapper from '../../../shared/parts/uilib/ItemWrapper' import DemoComponent, { @@ -17,7 +17,7 @@ import Description from 'dnb-ui-lib/src/components/slider/description.md' import Details from 'dnb-ui-lib/src/components/slider/details.md' import ExampleCode from 'raw-loader!../examples/Slider.txt' -export default class SliderDemo extends Component { +export default class SliderDemo extends PureComponent { static propTypes = { title: PropTypes.string, id: PropTypes.string, diff --git a/packages/dnb-design-system-portal/src/uilib/components/demos/Switch.js b/packages/dnb-design-system-portal/src/uilib/components/demos/Switch.js index 18dc42f42ac..a3989420159 100644 --- a/packages/dnb-design-system-portal/src/uilib/components/demos/Switch.js +++ b/packages/dnb-design-system-portal/src/uilib/components/demos/Switch.js @@ -7,7 +7,7 @@ * */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import ItemWrapper from '../../../shared/parts/uilib/ItemWrapper' import DemoComponent, { @@ -17,7 +17,7 @@ import Description from 'dnb-ui-lib/src/components/switch/description.md' import Details from 'dnb-ui-lib/src/components/switch/details.md' import ExampleCode from 'raw-loader!../examples/Switch.txt' -export default class SwitchDemo extends Component { +export default class SwitchDemo extends PureComponent { static propTypes = { title: PropTypes.string, id: PropTypes.string, diff --git a/packages/dnb-design-system-portal/src/uilib/components/demos/Tabs.js b/packages/dnb-design-system-portal/src/uilib/components/demos/Tabs.js index 9d9678fa9b8..9e332af1753 100644 --- a/packages/dnb-design-system-portal/src/uilib/components/demos/Tabs.js +++ b/packages/dnb-design-system-portal/src/uilib/components/demos/Tabs.js @@ -7,7 +7,7 @@ * */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import ItemWrapper from '../../../shared/parts/uilib/ItemWrapper' import DemoComponent, { @@ -17,7 +17,7 @@ import Description from 'dnb-ui-lib/src/components/tabs/description.md' import Details from 'dnb-ui-lib/src/components/tabs/details.md' import ExampleCode from 'raw-loader!../examples/Tabs.txt' -export default class TabsDemo extends Component { +export default class TabsDemo extends PureComponent { static propTypes = { title: PropTypes.string, id: PropTypes.string, diff --git a/packages/dnb-design-system-portal/src/uilib/components/demos/Template.js b/packages/dnb-design-system-portal/src/uilib/components/demos/Template.js index 391448c8f59..bc24657c17a 100644 --- a/packages/dnb-design-system-portal/src/uilib/components/demos/Template.js +++ b/packages/dnb-design-system-portal/src/uilib/components/demos/Template.js @@ -7,7 +7,7 @@ * */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import ItemWrapper from '../../../shared/parts/uilib/ItemWrapper' import DemoComponent, { @@ -17,7 +17,7 @@ import Description from 'dnb-ui-lib/src/components/template/description.md' import Details from 'dnb-ui-lib/src/components/template/details.md' import ExampleCode from 'raw-loader!../examples/Template.txt' -export default class TemplateDemo extends Component { +export default class TemplateDemo extends PureComponent { static propTypes = { title: PropTypes.string, id: PropTypes.string, diff --git a/packages/dnb-design-system-portal/src/uilib/patterns/demos/ActionNav.js b/packages/dnb-design-system-portal/src/uilib/patterns/demos/ActionNav.js index 847ce1181f7..eef2be8c6d6 100644 --- a/packages/dnb-design-system-portal/src/uilib/patterns/demos/ActionNav.js +++ b/packages/dnb-design-system-portal/src/uilib/patterns/demos/ActionNav.js @@ -7,7 +7,7 @@ * */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import ItemWrapper from '../../../shared/parts/uilib/ItemWrapper' import DemoComponent, { @@ -17,7 +17,7 @@ import Description from 'dnb-ui-lib/src/patterns/action-nav/description.md' import Details from 'dnb-ui-lib/src/patterns/action-nav/details.md' import ExampleCode from 'raw-loader!../examples/ActionNav.txt' -export default class ActionNavDemo extends Component { +export default class ActionNavDemo extends PureComponent { static propTypes = { title: PropTypes.string, id: PropTypes.string, diff --git a/packages/dnb-design-system-portal/src/uilib/patterns/demos/DescriptionList.js b/packages/dnb-design-system-portal/src/uilib/patterns/demos/DescriptionList.js index 0c1b5b9c46b..397ed5b9b48 100644 --- a/packages/dnb-design-system-portal/src/uilib/patterns/demos/DescriptionList.js +++ b/packages/dnb-design-system-portal/src/uilib/patterns/demos/DescriptionList.js @@ -7,7 +7,7 @@ * */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import ItemWrapper from '../../../shared/parts/uilib/ItemWrapper' import DemoComponent, { @@ -17,7 +17,7 @@ import Description from 'dnb-ui-lib/src/patterns/description-list/description.md import Details from 'dnb-ui-lib/src/patterns/description-list/details.md' import ExampleCode from 'raw-loader!../examples/DescriptionList.txt' -export default class DescriptionListDemo extends Component { +export default class DescriptionListDemo extends PureComponent { static propTypes = { title: PropTypes.string, id: PropTypes.string, diff --git a/packages/dnb-design-system-portal/src/uilib/patterns/demos/FieldsetDescription.js b/packages/dnb-design-system-portal/src/uilib/patterns/demos/FieldsetDescription.js index baae3d28ebe..ecdd7f5b38b 100644 --- a/packages/dnb-design-system-portal/src/uilib/patterns/demos/FieldsetDescription.js +++ b/packages/dnb-design-system-portal/src/uilib/patterns/demos/FieldsetDescription.js @@ -7,7 +7,7 @@ * */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import ItemWrapper from '../../../shared/parts/uilib/ItemWrapper' import DemoComponent, { @@ -17,7 +17,7 @@ import Description from 'dnb-ui-lib/src/patterns/fieldset-description/descriptio import Details from 'dnb-ui-lib/src/patterns/fieldset-description/details.md' import ExampleCode from 'raw-loader!../examples/FieldsetDescription.txt' -export default class FieldsetDescriptionDemo extends Component { +export default class FieldsetDescriptionDemo extends PureComponent { static propTypes = { title: PropTypes.string, id: PropTypes.string, diff --git a/packages/dnb-design-system-portal/src/uilib/patterns/demos/Footer.js b/packages/dnb-design-system-portal/src/uilib/patterns/demos/Footer.js index b5e1a34fefa..038d0a7732d 100644 --- a/packages/dnb-design-system-portal/src/uilib/patterns/demos/Footer.js +++ b/packages/dnb-design-system-portal/src/uilib/patterns/demos/Footer.js @@ -7,7 +7,7 @@ * */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import ItemWrapper from '../../../shared/parts/uilib/ItemWrapper' import DemoComponent, { @@ -17,7 +17,7 @@ import Description from 'dnb-ui-lib/src/patterns/footer/description.md' import Details from 'dnb-ui-lib/src/patterns/footer/details.md' import ExampleCode from 'raw-loader!../examples/Footer.txt' -export default class FooterDemo extends Component { +export default class FooterDemo extends PureComponent { static propTypes = { title: PropTypes.string, id: PropTypes.string, diff --git a/packages/dnb-design-system-portal/src/uilib/patterns/demos/Form.js b/packages/dnb-design-system-portal/src/uilib/patterns/demos/Form.js index a1fbeaa092f..a3cf39dde5d 100644 --- a/packages/dnb-design-system-portal/src/uilib/patterns/demos/Form.js +++ b/packages/dnb-design-system-portal/src/uilib/patterns/demos/Form.js @@ -7,7 +7,7 @@ * */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import ItemWrapper from '../../../shared/parts/uilib/ItemWrapper' import DemoComponent, { @@ -17,7 +17,7 @@ import Description from 'dnb-ui-lib/src/patterns/form/description.md' import Details from 'dnb-ui-lib/src/patterns/form/details.md' import ExampleCode from 'raw-loader!../examples/Form.txt' -export default class FormDemo extends Component { +export default class FormDemo extends PureComponent { static propTypes = { title: PropTypes.string, id: PropTypes.string, diff --git a/packages/dnb-design-system-portal/src/uilib/patterns/demos/FormSummary.js b/packages/dnb-design-system-portal/src/uilib/patterns/demos/FormSummary.js index f12ed7d4dc6..88a804d4b73 100644 --- a/packages/dnb-design-system-portal/src/uilib/patterns/demos/FormSummary.js +++ b/packages/dnb-design-system-portal/src/uilib/patterns/demos/FormSummary.js @@ -7,7 +7,7 @@ * */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import ItemWrapper from '../../../shared/parts/uilib/ItemWrapper' import DemoComponent, { @@ -17,7 +17,7 @@ import Description from 'dnb-ui-lib/src/patterns/form-summary/description.md' import Details from 'dnb-ui-lib/src/patterns/form-summary/details.md' import ExampleCode from 'raw-loader!../examples/FormSummary.txt' -export default class FormSummaryDemo extends Component { +export default class FormSummaryDemo extends PureComponent { static propTypes = { title: PropTypes.string, id: PropTypes.string, diff --git a/packages/dnb-design-system-portal/src/uilib/patterns/demos/Grid.js b/packages/dnb-design-system-portal/src/uilib/patterns/demos/Grid.js index 856a68f7a9f..40a0a011284 100644 --- a/packages/dnb-design-system-portal/src/uilib/patterns/demos/Grid.js +++ b/packages/dnb-design-system-portal/src/uilib/patterns/demos/Grid.js @@ -7,7 +7,7 @@ * */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import ItemWrapper from '../../../shared/parts/uilib/ItemWrapper' import DemoComponent, { @@ -17,7 +17,7 @@ import Description from 'dnb-ui-lib/src/patterns/grid/description.md' import Details from 'dnb-ui-lib/src/patterns/grid/details.md' import ExampleCode from 'raw-loader!../examples/Grid.txt' -export default class GridDemo extends Component { +export default class GridDemo extends PureComponent { static propTypes = { title: PropTypes.string, id: PropTypes.string, diff --git a/packages/dnb-design-system-portal/src/uilib/patterns/demos/HelperClasses.js b/packages/dnb-design-system-portal/src/uilib/patterns/demos/HelperClasses.js index 6659ab2550a..2581796e4f4 100644 --- a/packages/dnb-design-system-portal/src/uilib/patterns/demos/HelperClasses.js +++ b/packages/dnb-design-system-portal/src/uilib/patterns/demos/HelperClasses.js @@ -7,7 +7,7 @@ * */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import ItemWrapper from '../../../shared/parts/uilib/ItemWrapper' import DemoComponent, { @@ -17,7 +17,7 @@ import Description from 'dnb-ui-lib/src/patterns/helper-classes/description.md' import Details from 'dnb-ui-lib/src/patterns/helper-classes/details.md' import ExampleCode from 'raw-loader!../examples/HelperClasses.txt' -export default class HelperClassesDemo extends Component { +export default class HelperClassesDemo extends PureComponent { static propTypes = { title: PropTypes.string, id: PropTypes.string, diff --git a/packages/dnb-design-system-portal/src/uilib/patterns/demos/MainNav.js b/packages/dnb-design-system-portal/src/uilib/patterns/demos/MainNav.js index b7767124432..529aabffed2 100644 --- a/packages/dnb-design-system-portal/src/uilib/patterns/demos/MainNav.js +++ b/packages/dnb-design-system-portal/src/uilib/patterns/demos/MainNav.js @@ -7,7 +7,7 @@ * */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import ItemWrapper from '../../../shared/parts/uilib/ItemWrapper' import DemoComponent, { @@ -17,7 +17,7 @@ import Description from 'dnb-ui-lib/src/patterns/main-nav/description.md' import Details from 'dnb-ui-lib/src/patterns/main-nav/details.md' import ExampleCode from 'raw-loader!../examples/MainNav.txt' -export default class MainNavDemo extends Component { +export default class MainNavDemo extends PureComponent { static propTypes = { title: PropTypes.string, id: PropTypes.string, diff --git a/packages/dnb-design-system-portal/src/uilib/patterns/demos/RangeSlider.js b/packages/dnb-design-system-portal/src/uilib/patterns/demos/RangeSlider.js index aeb3740fb32..8a60881ead6 100644 --- a/packages/dnb-design-system-portal/src/uilib/patterns/demos/RangeSlider.js +++ b/packages/dnb-design-system-portal/src/uilib/patterns/demos/RangeSlider.js @@ -7,7 +7,7 @@ * */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import ItemWrapper from '../../../shared/parts/uilib/ItemWrapper' import DemoComponent, { @@ -17,7 +17,7 @@ import Description from 'dnb-ui-lib/src/patterns/range-slider/description.md' import Details from 'dnb-ui-lib/src/patterns/range-slider/details.md' import ExampleCode from 'raw-loader!../examples/RangeSlider.txt' -export default class RangeSliderDemo extends Component { +export default class RangeSliderDemo extends PureComponent { static propTypes = { title: PropTypes.string, id: PropTypes.string, diff --git a/packages/dnb-design-system-portal/src/uilib/patterns/demos/StepIndicator.js b/packages/dnb-design-system-portal/src/uilib/patterns/demos/StepIndicator.js index e568136f4e1..993e799b84f 100644 --- a/packages/dnb-design-system-portal/src/uilib/patterns/demos/StepIndicator.js +++ b/packages/dnb-design-system-portal/src/uilib/patterns/demos/StepIndicator.js @@ -7,7 +7,7 @@ * */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import ItemWrapper from '../../../shared/parts/uilib/ItemWrapper' import DemoComponent, { @@ -17,7 +17,7 @@ import Description from 'dnb-ui-lib/src/patterns/step-indicator/description.md' import Details from 'dnb-ui-lib/src/patterns/step-indicator/details.md' import ExampleCode from 'raw-loader!../examples/StepIndicator.txt' -export default class StepIndicatorDemo extends Component { +export default class StepIndicatorDemo extends PureComponent { static propTypes = { title: PropTypes.string, id: PropTypes.string, diff --git a/packages/dnb-design-system-portal/src/uilib/patterns/demos/SummaryTable.js b/packages/dnb-design-system-portal/src/uilib/patterns/demos/SummaryTable.js index ceed4e632b4..914ff6b3fcd 100644 --- a/packages/dnb-design-system-portal/src/uilib/patterns/demos/SummaryTable.js +++ b/packages/dnb-design-system-portal/src/uilib/patterns/demos/SummaryTable.js @@ -7,7 +7,7 @@ * */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import ItemWrapper from '../../../shared/parts/uilib/ItemWrapper' import DemoComponent, { @@ -17,7 +17,7 @@ import Description from 'dnb-ui-lib/src/patterns/summary-table/description.md' import Details from 'dnb-ui-lib/src/patterns/summary-table/details.md' import ExampleCode from 'raw-loader!../examples/SummaryTable.txt' -export default class SummaryTableDemo extends Component { +export default class SummaryTableDemo extends PureComponent { static propTypes = { title: PropTypes.string, id: PropTypes.string, diff --git a/packages/dnb-design-system-portal/src/uilib/patterns/demos/Template.js b/packages/dnb-design-system-portal/src/uilib/patterns/demos/Template.js index 02555e90bcf..888e1c7d333 100644 --- a/packages/dnb-design-system-portal/src/uilib/patterns/demos/Template.js +++ b/packages/dnb-design-system-portal/src/uilib/patterns/demos/Template.js @@ -7,7 +7,7 @@ * */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import ItemWrapper from '../../../shared/parts/uilib/ItemWrapper' import DemoComponent, { @@ -17,7 +17,7 @@ import Description from 'dnb-ui-lib/src/patterns/template/description.md' import Details from 'dnb-ui-lib/src/patterns/template/details.md' import ExampleCode from 'raw-loader!../examples/Template.txt' -export default class TemplateDemo extends Component { +export default class TemplateDemo extends PureComponent { static propTypes = { title: PropTypes.string, id: PropTypes.string, diff --git a/packages/dnb-design-system-portal/src/uilib/patterns/demos/Typography.js b/packages/dnb-design-system-portal/src/uilib/patterns/demos/Typography.js index 02204d9c175..e604a510aca 100644 --- a/packages/dnb-design-system-portal/src/uilib/patterns/demos/Typography.js +++ b/packages/dnb-design-system-portal/src/uilib/patterns/demos/Typography.js @@ -7,7 +7,7 @@ * */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import ItemWrapper from '../../../shared/parts/uilib/ItemWrapper' import DemoComponent, { @@ -17,7 +17,7 @@ import Description from 'dnb-ui-lib/src/patterns/typography/description.md' import Details from 'dnb-ui-lib/src/patterns/typography/details.md' import ExampleCode from 'raw-loader!../examples/Typography.txt' -export default class TypographyDemo extends Component { +export default class TypographyDemo extends PureComponent { static propTypes = { title: PropTypes.string, id: PropTypes.string, diff --git a/packages/dnb-design-system-portal/src/uilib/patterns/demos/ViewTitle.js b/packages/dnb-design-system-portal/src/uilib/patterns/demos/ViewTitle.js index e55f0c5c6ac..e41cf1ec593 100644 --- a/packages/dnb-design-system-portal/src/uilib/patterns/demos/ViewTitle.js +++ b/packages/dnb-design-system-portal/src/uilib/patterns/demos/ViewTitle.js @@ -7,7 +7,7 @@ * */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import ItemWrapper from '../../../shared/parts/uilib/ItemWrapper' import DemoComponent, { @@ -17,7 +17,7 @@ import Description from 'dnb-ui-lib/src/patterns/view-title/description.md' import Details from 'dnb-ui-lib/src/patterns/view-title/details.md' import ExampleCode from 'raw-loader!../examples/ViewTitle.txt' -export default class ViewTitleDemo extends Component { +export default class ViewTitleDemo extends PureComponent { static propTypes = { title: PropTypes.string, id: PropTypes.string, diff --git a/packages/dnb-ui-lib/src/components/button/Example.js b/packages/dnb-ui-lib/src/components/button/Example.js index 829d02b4008..3f5860abd00 100644 --- a/packages/dnb-ui-lib/src/components/button/Example.js +++ b/packages/dnb-ui-lib/src/components/button/Example.js @@ -3,12 +3,12 @@ * */ -import React, { Component, Fragment } from 'react' +import React, { PureComponent, Fragment } from 'react' import Button from './Button' import styled from 'react-emotion' import { bell_medium as Bell, question } from '../../../icons' -class Example extends Component { +class Example extends PureComponent { clickHandler = () => { alert('You clicked a button with a click function attached to it') } diff --git a/packages/dnb-ui-lib/src/components/dropdown/Example.js b/packages/dnb-ui-lib/src/components/dropdown/Example.js index adefa13021f..76f878e9d5e 100644 --- a/packages/dnb-ui-lib/src/components/dropdown/Example.js +++ b/packages/dnb-ui-lib/src/components/dropdown/Example.js @@ -3,11 +3,11 @@ * */ -import React, { Component, Fragment } from 'react' +import React, { PureComponent, Fragment } from 'react' import Dropdown from './Dropdown' import styled from 'react-emotion' -class Example extends Component { +class Example extends PureComponent { static AdditionalCallback = { info: ({ CodeRenderer }) => ( diff --git a/packages/dnb-ui-lib/src/components/form-label/Example.js b/packages/dnb-ui-lib/src/components/form-label/Example.js index 58ec6444ac9..dccda8d8b3c 100644 --- a/packages/dnb-ui-lib/src/components/form-label/Example.js +++ b/packages/dnb-ui-lib/src/components/form-label/Example.js @@ -3,11 +3,11 @@ * */ -import React, { Component, Fragment } from 'react' +import React, { PureComponent, Fragment } from 'react' import FormLabel from './FormLabel' import Switch from '../../components/switch/Switch' -class Example extends Component { +class Example extends PureComponent { render() { return ( diff --git a/packages/dnb-ui-lib/src/components/icon/Example.js b/packages/dnb-ui-lib/src/components/icon/Example.js index 56e487cf54e..0a3cd30887f 100644 --- a/packages/dnb-ui-lib/src/components/icon/Example.js +++ b/packages/dnb-ui-lib/src/components/icon/Example.js @@ -3,12 +3,12 @@ * */ -import React, { Component, Fragment } from 'react' +import React, { PureComponent, Fragment } from 'react' import Icon from './Icon' import IconWithAllIcons from './IconWithAllIcons' import { bell_medium as Bell } from './lib' -class Example extends Component { +class Example extends PureComponent { static AdditionalCallback = { info: ({ CodeRenderer }) => ( diff --git a/packages/dnb-ui-lib/src/components/input-masked/Example.js b/packages/dnb-ui-lib/src/components/input-masked/Example.js index 2ed5a239a48..d2169774d8a 100644 --- a/packages/dnb-ui-lib/src/components/input-masked/Example.js +++ b/packages/dnb-ui-lib/src/components/input-masked/Example.js @@ -3,7 +3,7 @@ * */ -import React, { Component, Fragment } from 'react' +import React, { PureComponent, Fragment } from 'react' import InputMasked from './InputMasked' import styled from 'react-emotion' @@ -14,7 +14,7 @@ const numberMask = createNumberMask({ suffix: ' kr.' }) -class Example extends Component { +class Example extends PureComponent { constructor(props) { super(props) this._ref = React.createRef() diff --git a/packages/dnb-ui-lib/src/components/input/Example.js b/packages/dnb-ui-lib/src/components/input/Example.js index 72026bce723..b46fe6825c2 100644 --- a/packages/dnb-ui-lib/src/components/input/Example.js +++ b/packages/dnb-ui-lib/src/components/input/Example.js @@ -3,11 +3,11 @@ * */ -import React, { Component, Fragment } from 'react' +import React, { PureComponent, Fragment } from 'react' import Input from './Input' import styled from 'react-emotion' -class Example extends Component { +class Example extends PureComponent { constructor(props) { super(props) this._ref = React.createRef() diff --git a/packages/dnb-ui-lib/src/components/line-title/Example.js b/packages/dnb-ui-lib/src/components/line-title/Example.js index 3f3f5fb5d43..bd7f2b6e470 100644 --- a/packages/dnb-ui-lib/src/components/line-title/Example.js +++ b/packages/dnb-ui-lib/src/components/line-title/Example.js @@ -3,10 +3,10 @@ * */ -import React, { Component, Fragment } from 'react' +import React, { PureComponent, Fragment } from 'react' import LineTitle from './LineTitle' -class Example extends Component { +class Example extends PureComponent { render() { return ( diff --git a/packages/dnb-ui-lib/src/components/logo/Example.js b/packages/dnb-ui-lib/src/components/logo/Example.js index 5c23ef8ff67..c2fe411d9c9 100644 --- a/packages/dnb-ui-lib/src/components/logo/Example.js +++ b/packages/dnb-ui-lib/src/components/logo/Example.js @@ -3,10 +3,10 @@ * */ -import React, { Component, Fragment } from 'react' +import React, { PureComponent, Fragment } from 'react' import Logo from './Logo' -class Example extends Component { +class Example extends PureComponent { render() { return ( diff --git a/packages/dnb-ui-lib/src/components/modal/Example.js b/packages/dnb-ui-lib/src/components/modal/Example.js index 45a03dec47b..41d9e669c1a 100644 --- a/packages/dnb-ui-lib/src/components/modal/Example.js +++ b/packages/dnb-ui-lib/src/components/modal/Example.js @@ -3,11 +3,11 @@ * */ -import React, { Component, Fragment } from 'react' +import React, { PureComponent, Fragment } from 'react' import Input from '../input/Input' import Modal from './Modal' -class Example extends Component { +class Example extends PureComponent { static AdditionalCallback = { info: ({ CodeRenderer }) => ( diff --git a/packages/dnb-ui-lib/src/components/notification/Example.js b/packages/dnb-ui-lib/src/components/notification/Example.js index 5ca6c0a385f..c3460e3b8a2 100644 --- a/packages/dnb-ui-lib/src/components/notification/Example.js +++ b/packages/dnb-ui-lib/src/components/notification/Example.js @@ -3,10 +3,10 @@ * */ -import React, { Component, Fragment } from 'react' +import React, { PureComponent, Fragment } from 'react' import Notification from './Notification' -class Example extends Component { +class Example extends PureComponent { render() { return ( diff --git a/packages/dnb-ui-lib/src/components/slider/Example.js b/packages/dnb-ui-lib/src/components/slider/Example.js index 8d6dd93b21c..69c823d804a 100644 --- a/packages/dnb-ui-lib/src/components/slider/Example.js +++ b/packages/dnb-ui-lib/src/components/slider/Example.js @@ -3,13 +3,13 @@ * */ -import React, { Component, Fragment } from 'react' +import React, { PureComponent, Fragment } from 'react' import styled from 'react-emotion' import Slider from './Slider' import Input from '../input/Input' import FormLabel from '../../components/form-label/FormLabel' -class Example extends Component { +class Example extends PureComponent { onChangeHandler = ({ value }) => { console.log('on_change', value) } @@ -34,7 +34,7 @@ class Example extends Component { } } -class AditionalExample extends Component { +class AditionalExample extends PureComponent { state = { value: 5908000 } diff --git a/packages/dnb-ui-lib/src/components/switch/Example.js b/packages/dnb-ui-lib/src/components/switch/Example.js index d0b6788adf3..863db7edca1 100644 --- a/packages/dnb-ui-lib/src/components/switch/Example.js +++ b/packages/dnb-ui-lib/src/components/switch/Example.js @@ -3,7 +3,7 @@ * */ -import React, { Component, Fragment } from 'react' +import React, { PureComponent, Fragment } from 'react' import PropTypes from 'prop-types' import Switch from './Switch' import FormLabel from '../../components/form-label/FormLabel' @@ -11,7 +11,7 @@ import FormLabel from '../../components/form-label/FormLabel' // we call this later on componentDidMount() // Switch.enableWebComponent() -class SwitchDemo extends Component { +class SwitchDemo extends PureComponent { static propTypes = { onStateUpdate: PropTypes.func.isRequired, onChange: PropTypes.func.isRequired @@ -52,7 +52,7 @@ class SwitchDemo extends Component { } } -class Example extends Component { +class Example extends PureComponent { state = { active_first: false, active_second: false diff --git a/packages/dnb-ui-lib/src/components/tabs/Example.js b/packages/dnb-ui-lib/src/components/tabs/Example.js index d3cc04ef9dc..dbdbd123228 100644 --- a/packages/dnb-ui-lib/src/components/tabs/Example.js +++ b/packages/dnb-ui-lib/src/components/tabs/Example.js @@ -3,12 +3,12 @@ * */ -import React, { Component, Fragment } from 'react' +import React, { PureComponent, Fragment } from 'react' import Tabs from './Tabs' import Input from '../input/Input' import styled from 'react-emotion' -class Example extends Component { +class Example extends PureComponent { static AdditionalCallback = { info: ({ CodeRenderer }) => ( diff --git a/packages/dnb-ui-lib/src/patterns/action-nav/ActionNav.js b/packages/dnb-ui-lib/src/patterns/action-nav/ActionNav.js index 1c750f0a82e..6ac77734324 100644 --- a/packages/dnb-ui-lib/src/patterns/action-nav/ActionNav.js +++ b/packages/dnb-ui-lib/src/patterns/action-nav/ActionNav.js @@ -3,7 +3,7 @@ * */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import classnames from 'classnames' import { @@ -54,7 +54,7 @@ export const defaultProps = { ...renderProps } -export default class ActionNav extends Component { +export default class ActionNav extends PureComponent { static tagName = 'dnb-action-nav' static propTypes = propTypes static defaultProps = defaultProps diff --git a/packages/dnb-ui-lib/src/patterns/action-nav/Example.js b/packages/dnb-ui-lib/src/patterns/action-nav/Example.js index 8a8c7800fb4..43117bf4f8d 100644 --- a/packages/dnb-ui-lib/src/patterns/action-nav/Example.js +++ b/packages/dnb-ui-lib/src/patterns/action-nav/Example.js @@ -3,11 +3,11 @@ * */ -import React, { Component, Fragment } from 'react' +import React, { PureComponent, Fragment } from 'react' import ActionNav from './ActionNav' import Button from '../../components/button/Button' -class Example extends Component { +class Example extends PureComponent { render() { return ( diff --git a/packages/dnb-ui-lib/src/patterns/description-list/DescriptionList.js b/packages/dnb-ui-lib/src/patterns/description-list/DescriptionList.js index d8883a2d1f3..4b65402c1d5 100644 --- a/packages/dnb-ui-lib/src/patterns/description-list/DescriptionList.js +++ b/packages/dnb-ui-lib/src/patterns/description-list/DescriptionList.js @@ -3,7 +3,7 @@ * */ -import React, { Component, Fragment } from 'react' +import React, { PureComponent, Fragment } from 'react' import PropTypes from 'prop-types' import classnames from 'classnames' import { @@ -48,7 +48,7 @@ export const defaultProps = { ...renderProps } -export default class DescriptionList extends Component { +export default class DescriptionList extends PureComponent { static tagName = 'dnb-description-list' static propTypes = propTypes static defaultProps = defaultProps diff --git a/packages/dnb-ui-lib/src/patterns/description-list/Example.js b/packages/dnb-ui-lib/src/patterns/description-list/Example.js index e00a7dc7b9a..f8ca79bf163 100644 --- a/packages/dnb-ui-lib/src/patterns/description-list/Example.js +++ b/packages/dnb-ui-lib/src/patterns/description-list/Example.js @@ -3,10 +3,10 @@ * */ -import React, { Component, Fragment } from 'react' +import React, { PureComponent, Fragment } from 'react' import DescriptionList from './DescriptionList' -class Example extends Component { +class Example extends PureComponent { render() { return ( diff --git a/packages/dnb-ui-lib/src/patterns/fieldset-description/Example.js b/packages/dnb-ui-lib/src/patterns/fieldset-description/Example.js index 8a90032e58c..2495ce518c0 100644 --- a/packages/dnb-ui-lib/src/patterns/fieldset-description/Example.js +++ b/packages/dnb-ui-lib/src/patterns/fieldset-description/Example.js @@ -3,10 +3,10 @@ * */ -import React, { Component, Fragment } from 'react' +import React, { PureComponent, Fragment } from 'react' import FieldsetDescription from './FieldsetDescription' -class Example extends Component { +class Example extends PureComponent { render() { return ( diff --git a/packages/dnb-ui-lib/src/patterns/fieldset-description/FieldsetDescription.js b/packages/dnb-ui-lib/src/patterns/fieldset-description/FieldsetDescription.js index c4d6a79e7cb..e05889e5175 100644 --- a/packages/dnb-ui-lib/src/patterns/fieldset-description/FieldsetDescription.js +++ b/packages/dnb-ui-lib/src/patterns/fieldset-description/FieldsetDescription.js @@ -3,7 +3,7 @@ * */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import PropTypes from 'prop-types' // import classnames from 'classnames' import { @@ -40,7 +40,7 @@ export const defaultProps = { ...renderProps } -export default class FieldsetDescription extends Component { +export default class FieldsetDescription extends PureComponent { static tagName = 'dnb-fieldset-description' static propTypes = propTypes static defaultProps = defaultProps diff --git a/packages/dnb-ui-lib/src/patterns/footer/Example.js b/packages/dnb-ui-lib/src/patterns/footer/Example.js index e8704254fa2..a3f6a7fc34e 100644 --- a/packages/dnb-ui-lib/src/patterns/footer/Example.js +++ b/packages/dnb-ui-lib/src/patterns/footer/Example.js @@ -3,9 +3,9 @@ * */ -import React, { Component, Fragment } from 'react' +import React, { PureComponent, Fragment } from 'react' -class Example extends Component { +class Example extends PureComponent { render() { return TODO: Example } diff --git a/packages/dnb-ui-lib/src/patterns/footer/Footer.js b/packages/dnb-ui-lib/src/patterns/footer/Footer.js index 01cd8ec75a5..1cc5cc5346f 100644 --- a/packages/dnb-ui-lib/src/patterns/footer/Footer.js +++ b/packages/dnb-ui-lib/src/patterns/footer/Footer.js @@ -3,7 +3,7 @@ * */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import classnames from 'classnames' import { @@ -39,7 +39,7 @@ export const defaultProps = { ...renderProps } -export default class Footer extends Component { +export default class Footer extends PureComponent { static tagName = 'dnb-footer' static propTypes = propTypes static defaultProps = defaultProps diff --git a/packages/dnb-ui-lib/src/patterns/form-summary/Example.js b/packages/dnb-ui-lib/src/patterns/form-summary/Example.js index e8704254fa2..a3f6a7fc34e 100644 --- a/packages/dnb-ui-lib/src/patterns/form-summary/Example.js +++ b/packages/dnb-ui-lib/src/patterns/form-summary/Example.js @@ -3,9 +3,9 @@ * */ -import React, { Component, Fragment } from 'react' +import React, { PureComponent, Fragment } from 'react' -class Example extends Component { +class Example extends PureComponent { render() { return TODO: Example } diff --git a/packages/dnb-ui-lib/src/patterns/form-summary/FormSummary.js b/packages/dnb-ui-lib/src/patterns/form-summary/FormSummary.js index dc5ab4c2c28..1355a1a4f68 100644 --- a/packages/dnb-ui-lib/src/patterns/form-summary/FormSummary.js +++ b/packages/dnb-ui-lib/src/patterns/form-summary/FormSummary.js @@ -3,7 +3,7 @@ * */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import classnames from 'classnames' import { @@ -47,7 +47,7 @@ export const defaultProps = { ...renderProps } -export default class FormSummary extends Component { +export default class FormSummary extends PureComponent { static tagName = 'dnb-form-summary' static propTypes = propTypes static defaultProps = defaultProps diff --git a/packages/dnb-ui-lib/src/patterns/form/Example.js b/packages/dnb-ui-lib/src/patterns/form/Example.js index e8704254fa2..a3f6a7fc34e 100644 --- a/packages/dnb-ui-lib/src/patterns/form/Example.js +++ b/packages/dnb-ui-lib/src/patterns/form/Example.js @@ -3,9 +3,9 @@ * */ -import React, { Component, Fragment } from 'react' +import React, { PureComponent, Fragment } from 'react' -class Example extends Component { +class Example extends PureComponent { render() { return TODO: Example } diff --git a/packages/dnb-ui-lib/src/patterns/form/Form.js b/packages/dnb-ui-lib/src/patterns/form/Form.js index f7d29222e95..f3d9cffe42e 100644 --- a/packages/dnb-ui-lib/src/patterns/form/Form.js +++ b/packages/dnb-ui-lib/src/patterns/form/Form.js @@ -3,7 +3,7 @@ * */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import classnames from 'classnames' import { @@ -35,7 +35,7 @@ export const defaultProps = { ...renderProps } -export default class Form extends Component { +export default class Form extends PureComponent { static tagName = 'dnb-form' static propTypes = propTypes static defaultProps = defaultProps diff --git a/packages/dnb-ui-lib/src/patterns/grid/Example.js b/packages/dnb-ui-lib/src/patterns/grid/Example.js index 43f392dab26..09b9222b078 100644 --- a/packages/dnb-ui-lib/src/patterns/grid/Example.js +++ b/packages/dnb-ui-lib/src/patterns/grid/Example.js @@ -3,11 +3,11 @@ * */ -import React, { Component, Fragment } from 'react' +import React, { PureComponent, Fragment } from 'react' import Grid from './Grid' import { css } from 'react-emotion' -class Example extends Component { +class Example extends PureComponent { render() { return ( diff --git a/packages/dnb-ui-lib/src/patterns/grid/Grid.js b/packages/dnb-ui-lib/src/patterns/grid/Grid.js index 06e459f8c56..84e2168616c 100644 --- a/packages/dnb-ui-lib/src/patterns/grid/Grid.js +++ b/packages/dnb-ui-lib/src/patterns/grid/Grid.js @@ -3,7 +3,7 @@ * */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import classnames from 'classnames' import { @@ -39,7 +39,7 @@ export const defaultProps = { ...renderProps } -export default class Grid extends Component { +export default class Grid extends PureComponent { static tagName = 'dnb-grid' static propTypes = propTypes static defaultProps = defaultProps diff --git a/packages/dnb-ui-lib/src/patterns/helper-classes/Example.js b/packages/dnb-ui-lib/src/patterns/helper-classes/Example.js index 09718847dc8..b068e65a995 100644 --- a/packages/dnb-ui-lib/src/patterns/helper-classes/Example.js +++ b/packages/dnb-ui-lib/src/patterns/helper-classes/Example.js @@ -3,10 +3,10 @@ * */ -import React, { Component, Fragment } from 'react' +import React, { PureComponent, Fragment } from 'react' import styled from 'react-emotion' -class Example extends Component { +class Example extends PureComponent { render() { return ( diff --git a/packages/dnb-ui-lib/src/patterns/helper-classes/HelperClasses.js b/packages/dnb-ui-lib/src/patterns/helper-classes/HelperClasses.js index 1b4a959c6c2..5dfdd7fa81e 100644 --- a/packages/dnb-ui-lib/src/patterns/helper-classes/HelperClasses.js +++ b/packages/dnb-ui-lib/src/patterns/helper-classes/HelperClasses.js @@ -3,10 +3,10 @@ * */ -import React, { Component, Fragment } from 'react' +import React, { PureComponent, Fragment } from 'react' // import './style/dnb-helper-classes.scss' // no good solution to import the style here -export default class HelperClasses extends Component { +export default class HelperClasses extends PureComponent { render() { return } diff --git a/packages/dnb-ui-lib/src/patterns/main-nav/Example.js b/packages/dnb-ui-lib/src/patterns/main-nav/Example.js index c824077dc7f..9bbc111f400 100644 --- a/packages/dnb-ui-lib/src/patterns/main-nav/Example.js +++ b/packages/dnb-ui-lib/src/patterns/main-nav/Example.js @@ -3,12 +3,12 @@ * */ -import React, { Component, Fragment } from 'react' +import React, { PureComponent, Fragment } from 'react' import MainNav from './MainNav' import styled from 'react-emotion' import Button from '../../components/button/Button' -class Example extends Component { +class Example extends PureComponent { render() { return ( diff --git a/packages/dnb-ui-lib/src/patterns/main-nav/MainNav.js b/packages/dnb-ui-lib/src/patterns/main-nav/MainNav.js index 6c118bd274f..e233572c7cc 100644 --- a/packages/dnb-ui-lib/src/patterns/main-nav/MainNav.js +++ b/packages/dnb-ui-lib/src/patterns/main-nav/MainNav.js @@ -3,7 +3,7 @@ * */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import classnames from 'classnames' import { @@ -54,7 +54,7 @@ export const defaultProps = { ...renderProps } -export default class MainNav extends Component { +export default class MainNav extends PureComponent { static tagName = 'dnb-main-nav' static propTypes = propTypes static defaultProps = defaultProps diff --git a/packages/dnb-ui-lib/src/patterns/range-slider/Example.js b/packages/dnb-ui-lib/src/patterns/range-slider/Example.js index e8704254fa2..a3f6a7fc34e 100644 --- a/packages/dnb-ui-lib/src/patterns/range-slider/Example.js +++ b/packages/dnb-ui-lib/src/patterns/range-slider/Example.js @@ -3,9 +3,9 @@ * */ -import React, { Component, Fragment } from 'react' +import React, { PureComponent, Fragment } from 'react' -class Example extends Component { +class Example extends PureComponent { render() { return TODO: Example } diff --git a/packages/dnb-ui-lib/src/patterns/range-slider/RangeSlider.js b/packages/dnb-ui-lib/src/patterns/range-slider/RangeSlider.js index 89687dcbc95..7143316f8db 100644 --- a/packages/dnb-ui-lib/src/patterns/range-slider/RangeSlider.js +++ b/packages/dnb-ui-lib/src/patterns/range-slider/RangeSlider.js @@ -3,7 +3,7 @@ * */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import classnames from 'classnames' import { @@ -52,7 +52,7 @@ export const defaultProps = { ...renderProps } -export default class RangeSlider extends Component { +export default class RangeSlider extends PureComponent { static tagName = 'dnb-range-slider' static propTypes = propTypes static defaultProps = defaultProps diff --git a/packages/dnb-ui-lib/src/patterns/step-indicator/Example.js b/packages/dnb-ui-lib/src/patterns/step-indicator/Example.js index ad090dcad44..39b2451d55a 100644 --- a/packages/dnb-ui-lib/src/patterns/step-indicator/Example.js +++ b/packages/dnb-ui-lib/src/patterns/step-indicator/Example.js @@ -3,11 +3,11 @@ * */ -import React, { Component, Fragment } from 'react' +import React, { PureComponent, Fragment } from 'react' import StepIndicator from './StepIndicator' import createHistory from 'history/createBrowserHistory' -class Example extends Component { +class Example extends PureComponent { static AdditionalCallback = { info: ({ CodeRenderer }) => ( diff --git a/packages/dnb-ui-lib/src/patterns/step-indicator/StepIndicator.js b/packages/dnb-ui-lib/src/patterns/step-indicator/StepIndicator.js index aa2ea269d6d..8a6516d387a 100644 --- a/packages/dnb-ui-lib/src/patterns/step-indicator/StepIndicator.js +++ b/packages/dnb-ui-lib/src/patterns/step-indicator/StepIndicator.js @@ -3,7 +3,7 @@ * */ -import React, { Component, Fragment } from 'react' +import React, { PureComponent, Fragment } from 'react' import PropTypes from 'prop-types' import classnames from 'classnames' import { @@ -58,7 +58,7 @@ export const defaultProps = { ...renderProps } -export default class StepIndicator extends Component { +export default class StepIndicator extends PureComponent { static tagName = 'dnb-step-indicator' static propTypes = propTypes static defaultProps = defaultProps @@ -178,7 +178,7 @@ export default class StepIndicator extends Component { } } -class ItemContent extends Component { +class ItemContent extends PureComponent { static propTypes = { activeItem: PropTypes.number.isRequired, number: PropTypes.number.isRequired, diff --git a/packages/dnb-ui-lib/src/patterns/summary-table/Example.js b/packages/dnb-ui-lib/src/patterns/summary-table/Example.js index 655b1c58352..521053ac183 100644 --- a/packages/dnb-ui-lib/src/patterns/summary-table/Example.js +++ b/packages/dnb-ui-lib/src/patterns/summary-table/Example.js @@ -3,11 +3,11 @@ * */ -import React, { Component, Fragment } from 'react' +import React, { PureComponent, Fragment } from 'react' import SummaryTable from './SummaryTable' import Button from '../../components/button/Button' -class Example extends Component { +class Example extends PureComponent { render() { return ( diff --git a/packages/dnb-ui-lib/src/patterns/summary-table/SummaryTable.js b/packages/dnb-ui-lib/src/patterns/summary-table/SummaryTable.js index 750750f1620..8ab1cac420a 100644 --- a/packages/dnb-ui-lib/src/patterns/summary-table/SummaryTable.js +++ b/packages/dnb-ui-lib/src/patterns/summary-table/SummaryTable.js @@ -3,7 +3,7 @@ * */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import PropTypes from 'prop-types' // import classnames from 'classnames' import { @@ -54,7 +54,7 @@ export const defaultProps = { ...renderProps } -export default class SummaryTable extends Component { +export default class SummaryTable extends PureComponent { static tagName = 'dnb-summary-table' static propTypes = propTypes static defaultProps = defaultProps diff --git a/packages/dnb-ui-lib/src/patterns/typography/Example.js b/packages/dnb-ui-lib/src/patterns/typography/Example.js index 01be2450b96..54bdb43c20c 100644 --- a/packages/dnb-ui-lib/src/patterns/typography/Example.js +++ b/packages/dnb-ui-lib/src/patterns/typography/Example.js @@ -3,7 +3,7 @@ * */ -import React, { Component, Fragment } from 'react' +import React, { PureComponent, Fragment } from 'react' import PropTypes from 'prop-types' import styled, { css } from 'react-emotion' import classnames from 'classnames' @@ -67,7 +67,7 @@ const Wrapper = styled.div` padding: 3rem 0 0; ` -class Example extends Component { +class Example extends PureComponent { static AdditionalCallback = { info: ({ CodeRenderer }) => ( diff --git a/packages/dnb-ui-lib/src/patterns/typography/Typography.js b/packages/dnb-ui-lib/src/patterns/typography/Typography.js index 388bf764ede..380e00f6952 100644 --- a/packages/dnb-ui-lib/src/patterns/typography/Typography.js +++ b/packages/dnb-ui-lib/src/patterns/typography/Typography.js @@ -3,10 +3,10 @@ * */ -import React, { Component, Fragment } from 'react' +import React, { PureComponent, Fragment } from 'react' // import './style/dnb-typography.scss' // no good solution to import the style here -export default class Typography extends Component { +export default class Typography extends PureComponent { render() { return } diff --git a/packages/dnb-ui-lib/src/patterns/view-title/Example.js b/packages/dnb-ui-lib/src/patterns/view-title/Example.js index a3f432b217c..34e3274fa66 100644 --- a/packages/dnb-ui-lib/src/patterns/view-title/Example.js +++ b/packages/dnb-ui-lib/src/patterns/view-title/Example.js @@ -3,10 +3,10 @@ * */ -import React, { Component, Fragment } from 'react' +import React, { PureComponent, Fragment } from 'react' import ViewTitle from './ViewTitle' -class Example extends Component { +class Example extends PureComponent { render() { return ( diff --git a/packages/dnb-ui-lib/src/patterns/view-title/ViewTitle.js b/packages/dnb-ui-lib/src/patterns/view-title/ViewTitle.js index 7065c1b377c..872e3e3721f 100644 --- a/packages/dnb-ui-lib/src/patterns/view-title/ViewTitle.js +++ b/packages/dnb-ui-lib/src/patterns/view-title/ViewTitle.js @@ -3,7 +3,7 @@ * */ -import React, { Component } from 'react' +import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import classnames from 'classnames' import { @@ -43,7 +43,7 @@ export const defaultProps = { ...renderProps } -export default class ViewTitle extends Component { +export default class ViewTitle extends PureComponent { static tagName = 'dnb-view-title' static propTypes = propTypes static defaultProps = defaultProps diff --git a/packages/dnb-ui-lib/stories/components.js b/packages/dnb-ui-lib/stories/components.js index ba9f8566b87..70dcfc45aeb 100644 --- a/packages/dnb-ui-lib/stories/components.js +++ b/packages/dnb-ui-lib/stories/components.js @@ -95,7 +95,7 @@ components.push([ components.sort(([a], [b]) => (a > b ? 1 : -1)) // dnb.enableWebComponents() -// class SwitchWrapper extends Component { +// class SwitchWrapper extends PureComponent { // state = { // checked: false // } @@ -140,7 +140,7 @@ components.sort(([a], [b]) => (a > b ? 1 : -1)) // } // } // -// class InputWrapper extends Component { +// class InputWrapper extends PureComponent { // state = { // value: 'X', // placeholder: 'Write someting', @@ -198,7 +198,7 @@ components.sort(([a], [b]) => (a > b ? 1 : -1)) // } // } // -// class DropdownWrapper extends Component { +// class DropdownWrapper extends PureComponent { // state = { // selected_item: 1 // } diff --git a/packages/examples/example-react/src/App.jsx b/packages/examples/example-react/src/App.jsx index 985f98a78fe..7075d32b222 100644 --- a/packages/examples/example-react/src/App.jsx +++ b/packages/examples/example-react/src/App.jsx @@ -3,7 +3,7 @@ * */ -import React, { Component, Fragment } from 'react'; +import React, { PureComponent, Fragment } from 'react'; import './App.css'; // different mothodes of importing the dnb-ui-lib @@ -20,7 +20,7 @@ import 'dnb-ui-lib/style'; // Import the global DNB stylesheet // to enable Web Components, cause we use both react and Web Components in here -export default class App extends Component { +export default class App extends PureComponent { state = { showWebComponents: false }; constructor(props) { super(props); diff --git a/yarn.lock b/yarn.lock index 2d5de618934..204737e9ffd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5848,7 +5848,7 @@ debug@~2.2.0: dependencies: ms "0.7.1" -debuglog@*, debuglog@^1.0.1: +debuglog@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492" integrity sha1-qiT/uaw9+aI1GDfPstJ5NgzXhJI= @@ -8502,7 +8502,7 @@ gatsby-source-filesystem@^2.0.8: valid-url "^1.0.9" xstate "^3.1.0" -gatsby@^2.0.54: +gatsby@^2.0.55: version "2.0.55" resolved "https://registry.yarnpkg.com/gatsby/-/gatsby-2.0.55.tgz#e86e2ce35da629121c28859ee6215d110b307b41" integrity sha512-L3Cx9EQ0HznOgeC/f8clUGSlIXHO3+65Yfr/mKnXLMNKz5S+TBNHWpB0z9691hpDwLydS4kEsoO419iWa9Wltg== @@ -10130,7 +10130,7 @@ import-local@^2.0.0: pkg-dir "^3.0.0" resolve-cwd "^2.0.0" -imurmurhash@*, imurmurhash@^0.1.4: +imurmurhash@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= @@ -12160,11 +12160,6 @@ lodash._basecopy@^3.0.0: resolved "https://registry.yarnpkg.com/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz#8da0e6a876cf344c0ad8a54882111dd3c5c7ca36" integrity sha1-jaDmqHbPNEwK2KVIghEd08XHyjY= -lodash._baseindexof@*: - version "3.1.0" - resolved "https://registry.yarnpkg.com/lodash._baseindexof/-/lodash._baseindexof-3.1.0.tgz#fe52b53a1c6761e42618d654e4a25789ed61822c" - integrity sha1-/lK1OhxnYeQmGNZU5KJXie1hgiw= - lodash._basetostring@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/lodash._basetostring/-/lodash._basetostring-3.0.1.tgz#d1861d877f824a52f669832dcaf3ee15566a07d5" @@ -12183,29 +12178,12 @@ lodash._basevalues@^3.0.0: resolved "https://registry.yarnpkg.com/lodash._basevalues/-/lodash._basevalues-3.0.0.tgz#5b775762802bde3d3297503e26300820fdf661b7" integrity sha1-W3dXYoAr3j0yl1A+JjAIIP32Ybc= -lodash._bindcallback@*: - version "3.0.1" - resolved "https://registry.yarnpkg.com/lodash._bindcallback/-/lodash._bindcallback-3.0.1.tgz#e531c27644cf8b57a99e17ed95b35c748789392e" - integrity sha1-5THCdkTPi1epnhftlbNcdIeJOS4= - -lodash._cacheindexof@*: - version "3.0.2" - resolved "https://registry.yarnpkg.com/lodash._cacheindexof/-/lodash._cacheindexof-3.0.2.tgz#3dc69ac82498d2ee5e3ce56091bafd2adc7bde92" - integrity sha1-PcaayCSY0u5ePOVgkbr9Ktx73pI= - -lodash._createcache@*: - version "3.1.2" - resolved "https://registry.yarnpkg.com/lodash._createcache/-/lodash._createcache-3.1.2.tgz#56d6a064017625e79ebca6b8018e17440bdcf093" - integrity sha1-VtagZAF2JeeevKa4AY4XRAvc8JM= - dependencies: - lodash._getnative "^3.0.0" - lodash._createset@~4.0.0: version "4.0.3" resolved "https://registry.yarnpkg.com/lodash._createset/-/lodash._createset-4.0.3.tgz#0f4659fbb09d75194fa9e2b88a6644d363c9fe26" integrity sha1-D0ZZ+7CddRlPqeK4imZE02PJ/iY= -lodash._getnative@*, lodash._getnative@^3.0.0: +lodash._getnative@^3.0.0: version "3.9.1" resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5" integrity sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U= @@ -12371,7 +12349,7 @@ lodash.pick@^4.4.0: resolved "https://registry.yarnpkg.com/lodash.pick/-/lodash.pick-4.4.0.tgz#52f05610fff9ded422611441ed1fc123a03001b3" integrity sha1-UvBWEP/53tQiYRRB7R/BI6AwAbM= -lodash.restparam@*, lodash.restparam@^3.0.0: +lodash.restparam@^3.0.0: version "3.6.1" resolved "https://registry.yarnpkg.com/lodash.restparam/-/lodash.restparam-3.6.1.tgz#936a4e309ef330a7645ed4145986c85ae5b20805" integrity sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU= @@ -17248,7 +17226,7 @@ readable-stream@~1.1.10, readable-stream@~1.1.9: isarray "0.0.1" string_decoder "~0.10.x" -readdir-scoped-modules@*, readdir-scoped-modules@^1.0.0: +readdir-scoped-modules@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/readdir-scoped-modules/-/readdir-scoped-modules-1.0.2.tgz#9fafa37d286be5d92cbaebdee030dc9b5f406747" integrity sha1-n6+jfShr5dksuuve4DDcm19AZ0c=