1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00
unleash.unleash/public/js/components/FeatureList.jsx
2020-02-20 08:30:13 +01:00

55 lines
1.7 KiB
JavaScript

var React = require('react');
var SavedFeature = require('./SavedFeature');
var UnsavedFeature = require('./UnsavedFeature');
var FeatureList = React.createClass({
render: function() {
var featureNodes = [];
this.props.unsavedFeatures.forEach(function(feature, idx) {
var key = 'new-' + idx;
featureNodes.push(
<UnsavedFeature
key={key}
feature={feature}
onSubmit={this.props.onFeatureSubmit}
onCancel={this.props.onFeatureCancel} />
);
}.bind(this));
this.props.savedFeatures.forEach(function(feature) {
featureNodes.push(
<SavedFeature
key={feature.name}
feature={feature}
onChange={this.props.onFeatureChanged} />
);
}.bind(this));
return (
<div className="container">
<div className="mod shadow mts">
<div className="inner">
<div className="bd">
<div className="line">
<div className="unit r-size1of4">
<h2>Features</h2>
</div>
<div className="unit r-size3of4 rightify prl ptm">
<button className="" onClick={this.props.onNewFeature}>New</button>
</div>
</div>
<hr />
{featureNodes}
</div>
</div>
</div>
</div>
);
}
});
module.exports = FeatureList;