import React, {Component} from "react";
import style from './index.less';
import checkOnIcon from '@common/images/check_on.png';
import checkOffIcon from '@common/images/check_off.png';

class Filters extends Component {
  constructor(props) {
    super(props);
  }
  drawItem(){
    const {data,checkeds,handleCheck} = this.props;
    let isChecked=false;
    return data.map((it)=>{
      isChecked = checkeds.includes(it.val);
      return <span onClick={()=>handleCheck(it.val)}>
                  <img src={isChecked?checkOnIcon:checkOffIcon} alt=""/>
                  {it.name}
                </span>
    })
  }
  render() {
    return <div className={style["filters"]} id='medicalInfoFilter'>
              {this.drawItem()}
            </div>



  }
}

export default Filters;