Skip to content

Commit

Permalink
handle empty section
Browse files Browse the repository at this point in the history
  • Loading branch information
itsnotrisky committed Nov 25, 2018
1 parent 841761f commit f172003
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions src/components/sections/Section.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
import React, { Component } from 'react';
import React, { PureComponent } from 'react';
import SectionItem from './SectionItem';

class Section extends Component {
render() {
return (
<div>
export default function Section({ data, id, title }) {
if ( data.length === 0 ) return null
return (
<div>
<div className="row">
<div className="col-lg-12">
<h2 id={this.props.id}>{this.props.title}</h2>
<h2 id={id}>{title}</h2>
</div>
</div>
{
this.props.data.map(function(data, key) {
return (
<SectionItem data={data} key={key} />
);
})
data.map((data, key) => (
<SectionItem data={data} key={key} />
))
}
</div>
)
}
</div>
)
}

export default Section;

0 comments on commit f172003

Please sign in to comment.