{"size": 985, "ext": "js", "max_stars_repo_path": "src/components/Rules.js", "max_stars_repo_name": "sepehr1313/flow-engine", "max_stars_repo_stars_event_min_datetime": "2018-01-15T15:15:10.000Z", "max_stars_repo_stars_event_max_datetime": "2018-01-15T15:15:10.000Z", "max_issues_repo_path": "src/components/Rules.js", "max_issues_repo_name": "sepehr1313/flow-engine", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/components/Rules.js", "max_forks_repo_name": "sepehr1313/flow-engine", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 28.9705882353, "max_line_length": 58, "alphanum_fraction": 0.4598984772}
import React from 'react';
import RuleComponent from './RuleComponent';
import data from '../data';

export default class Rules extends React.Component {
    renderRules() {
        let rulesArray = [];
        this.props.rules.map((item, index) => {
            rulesArray.push(
                <RuleComponent
                    key={`rule-item-${index}`}
                    data={item.isRoot && data}
                    ruleId={item.id}
                    title={item.title}
                    passedId={item.nextIfPassed}
                    failedId={item.nextIfFailed}
                    isFailureCheck={item.isFailureCheck}
                    status = {item.status}
                    changeStatus={this.props.changeStatus}
                    ruleBody={item.ruleBody}
                />
            )
        });
        return rulesArray;
    }

    render() {
        return (
            <div>
                {this.renderRules()}
            </div>
        )
    }
}