added check for new component to ensure correct representation, in my opinion still unpleasant

This commit is contained in:
Florian Scholdei
2019-04-19 13:27:12 +02:00
parent f209ca665d
commit ef35a2050c

View File

@@ -7,6 +7,7 @@ import ErrorNotification from "./../ErrorNotification";
import Title from "./Title"; import Title from "./Title";
import Subtitle from "./Subtitle"; import Subtitle from "./Subtitle";
import PageActions from "./PageActions"; import PageActions from "./PageActions";
import OverviewPageActions from "../OverviewPageActions";
import ErrorBoundary from "../ErrorBoundary"; import ErrorBoundary from "../ErrorBoundary";
type Props = { type Props = {
@@ -29,7 +30,6 @@ const styles = {
}; };
class Page extends React.Component<Props> { class Page extends React.Component<Props> {
render() { render() {
const { error } = this.props; const { error } = this.props;
return ( return (
@@ -51,7 +51,11 @@ class Page extends React.Component<Props> {
let pageActions = null; let pageActions = null;
let pageActionsExists = false; let pageActionsExists = false;
React.Children.forEach(children, child => { React.Children.forEach(children, child => {
if (child && child.type.name === PageActions.name && !error) { if (child && !error) {
if (
child.type.name === PageActions.name ||
child.type.name === OverviewPageActions.name
)
pageActions = ( pageActions = (
<div <div
className={classNames( className={classNames(
@@ -95,9 +99,14 @@ class Page extends React.Component<Props> {
let content = []; let content = [];
React.Children.forEach(children, child => { React.Children.forEach(children, child => {
if (child && child.type.name !== PageActions.name) { if (child) {
if (
child.type.name !== PageActions.name &&
child.type.name !== OverviewPageActions.name
) {
content.push(child); content.push(child);
} }
}
}); });
return content; return content;
} }