import * as classNames from "classnames"; import { observer } from "mobx-react"; import * as React from "react"; import FontAwesome = require("react-fontawesome"); import { Table } from "semantic-ui-react"; import { Section } from "@common/sprinklers"; /* tslint:disable:object-literal-sort-keys */ @observer export default class SectionTable extends React.Component<{ sections: Section[] }> { private static renderRow(section: Section, index: number) { if (!section) { return null; } const { name, state } = section; const sectionStateClass = classNames({ "section--state": true, "section--state-true": state, "section--state-false": !state, }); const sectionState = state ? ( Irrigating) : "Not irrigating"; return ( {"" + (index + 1)} {name} {sectionState} ); } render() { const rows = this.props.sections.map(SectionTable.renderRow); return ( Sections # Name State {rows}
); } }