From 953f0c700006041f9c2e58ce246355a394fb17a3 Mon Sep 17 00:00:00 2001 From: Florian Scholdei Date: Wed, 24 Jul 2019 17:30:40 +0200 Subject: [PATCH] defining class attribute instead of using component name --- scm-ui-components/packages/ui-components/src/layout/Page.js | 4 ++-- .../packages/ui-components/src/layout/PageActions.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scm-ui-components/packages/ui-components/src/layout/Page.js b/scm-ui-components/packages/ui-components/src/layout/Page.js index 403bae91e6..c7a7f66cf4 100644 --- a/scm-ui-components/packages/ui-components/src/layout/Page.js +++ b/scm-ui-components/packages/ui-components/src/layout/Page.js @@ -51,7 +51,7 @@ class Page extends React.Component { let pageActionsExists = false; React.Children.forEach(children, child => { if (child && !error) { - if (child.type.name === PageActions.name) { + if (child.displayName === PageActions.displayName) { pageActions = (
{ let content = []; React.Children.forEach(children, child => { if (child) { - if (child.type.name !== PageActions.name) { + if (child.displayName !== PageActions.displayName) { content.push(child); } } diff --git a/scm-ui-components/packages/ui-components/src/layout/PageActions.js b/scm-ui-components/packages/ui-components/src/layout/PageActions.js index eb055a5605..d713e8ce11 100644 --- a/scm-ui-components/packages/ui-components/src/layout/PageActions.js +++ b/scm-ui-components/packages/ui-components/src/layout/PageActions.js @@ -8,7 +8,9 @@ type Props = { children: React.Node }; -class PageActions extends React.Component { +export default class PageActions extends React.Component { + displayName: string = "PageActions"; + render() { return <>{this.renderContent()}; } @@ -24,5 +26,3 @@ class PageActions extends React.Component { return children; } } - -export default PageActions;