{"size": 1124, "ext": "js", "max_stars_repo_path": "src/leases/components/leaseSections/constructability/StatusIndicator.js", "max_stars_repo_name": "igordavydsson/mvj-ui", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/leases/components/leaseSections/constructability/StatusIndicator.js", "max_issues_repo_name": "igordavydsson/mvj-ui", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/leases/components/leaseSections/constructability/StatusIndicator.js", "max_forks_repo_name": "igordavydsson/mvj-ui", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 36.2580645161, "max_line_length": 136, "alphanum_fraction": 0.7339857651}
// @flow
import React, {Fragment} from 'react';
import classnames from 'classnames';

import {ConstructabilityStatus} from '$src/leases/enums';
import {getLabelOfOption} from '$util/helpers';

type StatusIndicatorProps = {
  researchState: string,
  stateOptions: Array<Object>,
}

const StatusIndicator = ({researchState, stateOptions}: StatusIndicatorProps) =>
  <Fragment>
    <div className={
      classnames(
        {'collapse__header_icon collapse__header_icon--neutral': !researchState || researchState === ConstructabilityStatus.UNVERIFIED},
        {'collapse__header_icon collapse__header_icon--alert': researchState === ConstructabilityStatus.REQUIRES_MEASURES},
        {'collapse__header_icon collapse__header_icon--success': researchState === ConstructabilityStatus.COMPLETE},
        {'collapse__header_icon collapse__header_icon--enquiry-sent': researchState === ConstructabilityStatus.ENQUIRY_SENT},
      )
    }>
      <i/>
      <span>
        {getLabelOfOption(stateOptions, researchState || ConstructabilityStatus.UNVERIFIED)}
      </span>
    </div>
  </Fragment>;

export default StatusIndicator;
