From 494a50f64bb0bc0330eb44185d77226ac39f0f8f Mon Sep 17 00:00:00 2001 From: Dave Landry Date: Thu, 23 Feb 2017 15:35:19 -0500 Subject: [PATCH] Sections now support solo children --- app/pages/Child.jsx | 2 +- src/components/Section.jsx | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/pages/Child.jsx b/app/pages/Child.jsx index 1862a1919..c99a55129 100644 --- a/app/pages/Child.jsx +++ b/app/pages/Child.jsx @@ -17,7 +17,7 @@ class Child extends SectionColumns { d.crop_name || d.crop, + label: d => d.crop_name, legend: false, sum: d => d.harvested_area }} /> diff --git a/src/components/Section.jsx b/src/components/Section.jsx index 95ceeab01..b73a98e82 100644 --- a/src/components/Section.jsx +++ b/src/components/Section.jsx @@ -10,7 +10,9 @@ class Section extends Component { } render() { - const {children, type} = this.props; + const {type} = this.props; + let {children} = this.props; + if (!(children instanceof Array)) children = [children]; const title = children.filter(c => c.type.displayName === "SectionTitle"); const content = children.filter(c => c.type.displayName !== "SectionTitle"); return (