Skip to content

Commit

Permalink
Sections now support solo children
Browse files Browse the repository at this point in the history
  • Loading branch information
davelandry committed Feb 23, 2017
1 parent a81631f commit 494a50f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/pages/Child.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Child extends SectionColumns {
<Treemap config={{
data,
groupBy: "crop",
label: d => d.crop_name || d.crop,
label: d => d.crop_name,
legend: false,
sum: d => d.harvested_area
}} />
Expand Down
4 changes: 3 additions & 1 deletion src/components/Section.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down

0 comments on commit 494a50f

Please sign in to comment.