From ef35a2050ceba42ccc8f8d9e4d165769c3e5e684 Mon Sep 17 00:00:00 2001 From: Florian Scholdei Date: Fri, 19 Apr 2019 13:27:12 +0200 Subject: [PATCH] added check for new component to ensure correct representation, in my opinion still unpleasant --- .../packages/ui-components/src/layout/Page.js | 37 ++++++++++++------- 1 file changed, 23 insertions(+), 14 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 c6f5d132a5..6c44112074 100644 --- a/scm-ui-components/packages/ui-components/src/layout/Page.js +++ b/scm-ui-components/packages/ui-components/src/layout/Page.js @@ -7,6 +7,7 @@ import ErrorNotification from "./../ErrorNotification"; import Title from "./Title"; import Subtitle from "./Subtitle"; import PageActions from "./PageActions"; +import OverviewPageActions from "../OverviewPageActions"; import ErrorBoundary from "../ErrorBoundary"; type Props = { @@ -29,7 +30,6 @@ const styles = { }; class Page extends React.Component { - render() { const { error } = this.props; return ( @@ -51,17 +51,21 @@ class Page extends React.Component { let pageActions = null; let pageActionsExists = false; React.Children.forEach(children, child => { - if (child && child.type.name === PageActions.name && !error) { - pageActions = ( -
- {child} -
- ); + if (child && !error) { + if ( + child.type.name === PageActions.name || + child.type.name === OverviewPageActions.name + ) + pageActions = ( +
+ {child} +
+ ); pageActionsExists = true; } }); @@ -95,8 +99,13 @@ class Page extends React.Component { let content = []; React.Children.forEach(children, child => { - if (child && child.type.name !== PageActions.name) { - content.push(child); + if (child) { + if ( + child.type.name !== PageActions.name && + child.type.name !== OverviewPageActions.name + ) { + content.push(child); + } } }); return content;