import { Component } from 'react' 
import { Nombre } from './Nombre'
import style from './Compteur.module.scss'

export class Compteur extends Component {
  _getCount(count) {
    const counts = count.toString().split('')
    
    return counts.map(_count => {
      if (_count === '-') {
        return <span className={style.vote__column}>-</span>
      } else {
        return <Nombre current={parseFloat(_count)} />
      }
    })
  }

  render() {

    
    return(
      <div className={style.vote}>
        <p className={style.vote__column}>{this.props.teamName}</p>
        <div className={style.vote__columns}>
          {this._getCount(this.props.score)}
        </div>
      </div>
    )
  }
}

