{"size": 1041, "ext": "js", "max_stars_repo_path": "js/components/parts/GridsPage/Grid.react.js", "max_stars_repo_name": "Sumi-Interactive/type-front", "max_stars_repo_stars_event_min_datetime": "2016-04-12T14:21:27.000Z", "max_stars_repo_stars_event_max_datetime": "2016-04-30T08:18:45.000Z", "max_issues_repo_path": "js/components/parts/GridsPage/Grid.react.js", "max_issues_repo_name": "Sumi-Interactive/Type-Front", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "js/components/parts/GridsPage/Grid.react.js", "max_forks_repo_name": "Sumi-Interactive/Type-Front", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 6, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 25.3902439024, "max_line_length": 95, "alphanum_fraction": 0.5158501441}
import React, { Component } from 'react'

import { openListSingleView } from '../../../actions/AppActions'

import Pic from '../../../../img/pic.png'

export default class Grid extends Component {
  openGridEdit(gridId) {
    this.props.dispatch(openListSingleView(gridId))
  }

  render() {
    let grid = this.props
    let withImageFlag = [this.props.photo_url].join('').length ? 'with-image' : 'without-image'
    let contentEmptyFlag = [this.props.content].join('').length ? '' : 'empty '

    return (
      <div
        className={contentEmptyFlag + "grid"}
        onClick={this.openGridEdit.bind(this, grid.id)}
        title={grid.title}
      >
        <h3>{grid.title}</h3>
        <p>
          {[grid.content].join('').split('\n').map((line, index) => {
            return (
              <span key={index}>
                {line}
                <br />
              </span>
            )
          })}
        </p>
        <span className={withImageFlag}>
          <img src={Pic} />
        </span>
      </div>
    )
  }
}
