1
0
mirror of https://github.com/ascribe/onion.git synced 2024-11-15 09:35:10 +01:00
onion/js/components/table.js
2015-05-20 16:44:45 +02:00

35 lines
829 B
JavaScript

import React from 'react';
import TableItem from './table_item';
import TableHeader from './table_header';
let Table = React.createClass({
propTypes: {
columnMap: React.PropTypes.object.isRequired
},
render() {
if(this.props.itemList && this.props.itemList.length > 0) {
return (
<div>
<TableHeader columnMap={this.props.columnMap}/>
{this.props.itemList.map((item, i) => {
return (
<TableItem columnMap={this.props.columnMap} columnContent={item} key={i} />
);
})}
</div>
);
} else {
return (
<p>Loading</p>
);
}
}
});
export default Table;