<commit_before>React = require 'react'

class Header extends React.Component
  @displayName = 'Header'
  @propTypes:
    menuItems: React.PropTypes.array

  constructor: (@props) ->

  render: =>
    <div className="header-inner">
      {@_renderLogo()}

      <ul className="list list-reset tabs-list">
        {@_renderMenuItems()}
        
        <li className="tabs-tab new-tab">
          <span className="octicon octicon-plus"></span>
        </li>
      </ul>

      <div className="history-buttons">
        <div className="history-button left active">
          <span className="mega-octicon octicon-chevron-left"></span>
        </div>

        <div className="history-button right disabled">
          <span className="mega-octicon octicon-chevron-right"></span>
        </div>
      </div>
    </div>

  _renderLogo: ->
    if process.platform != 'win32'
      <div className="logo">
        <a className="logo-link"></a>
      </div>
    else return <div></div>

  _renderMenuItems: =>
    @props.menuItems.map (item, index) ->
      classnames = if index is 0 then 'active' else ''

      <li className="tabs-tab #{classnames}" key={index}>
        <a className="tabs-item">{item.name}</a>
        <span className="octicon octicon-x"></span>
      </li>

module.exports = Header<commit_msg>Add ability to close tabs<commit_after>React = require 'react'

class Header extends React.Component
  @displayName = 'Header'
  @propTypes:
    menuItems: React.PropTypes.array

  constructor: (@props) ->
    @state =
      menuItems: @props.menuItems

  render: =>
    <div className="header-inner">
      {@_renderLogo()}

      <ul className="list list-reset tabs-list">
        {@_renderMenuItems()}
        
        <li className="tabs-tab new-tab">
          <span className="octicon octicon-plus"></span>
        </li>
      </ul>

      <div className="history-buttons">
        <div className="history-button left active">
          <span className="mega-octicon octicon-chevron-left"></span>
        </div>

        <div className="history-button right disabled">
          <span className="mega-octicon octicon-chevron-right"></span>
        </div>
      </div>
    </div>

  _renderLogo: ->
    if process.platform != 'win32'
      <div className="logo">
        <a className="logo-link"></a>
      </div>
    else return <div></div>

  _renderMenuItems: =>
    @state.menuItems.map (item, index) =>
      classnames = if index is 0 then 'active' else ''

      <li className="tabs-tab #{classnames}" key={index}>
        <a className="tabs-item">{item.name}</a>

        <span className="octicon octicon-x" value={index} onClick={@_handleCloseItem}></span>
      </li>

  _handleCloseItem: (e) =>
    index = parseInt(e.target.value, 10)

    @setState (state) ->
      state.menuItems.splice(index, 1)

      menuItems: state.menuItems

module.exports = Header
{'fraction_non_alphanumeric': 0.15520833333333334, 'fraction_numerical': 0.003125, 'mean_word_length': 2.596754057428215, 'pattern_counts': {'":': 0, '<': 63, '<?xml version=': 0, '>': 75, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3485856', 'n_tokens_mistral': 901, 'n_tokens_neox': 874, 'n_words': 193}