import React from 'react'
import style from './index.less'
import PropTypes from 'prop-types'

class Item extends React.Component{
    getClazz(){
        if(this.props.value===this.props.select){
            return `${style.item} ${style.active}`
        }
        return style.item;
    }

    handleClick(){
        this.props.handleClick(this.props.value);
    }

    render(){
        return (
            <span className={this.getClazz()} onClick={()=>this.handleClick()}>{`${this.props.value}月`}</span>
        )
    }
}

Item.propTypes={
    value:PropTypes.number,
    handleClick:PropTypes.func,
    select:PropTypes.number
};

export default Item;