import React, { Component } from "react";
import style from './index.less';
import more from '@common/images/addItem1.png';

/**
* 子模板标签组件，如添加病程变化
* 单纯展示组件，接收两个参数：
* showText：展示文字；
* handleTailClick：点击事件；
**/

class TailInlineTag extends React.PureComponent {
  
  handleClick(e){
    // e.stopPropagation(); //冒泡到最顶层关闭其他下拉
    const {handleTailClick,questionMapping,id,relationModule} = this.props;
    handleTailClick && handleTailClick({questionMapping,id,relationModule});
  }

  render(){
    const {showText} = this.props;
    return <div className={style['tag-container']} onClick={this.handleClick.bind(this)}> 
        <img src={more} />  
        <div className={style['gray']} contentEditable="false" >
          {showText?<span>{showText}</span>:''}
        </div>
      </div>
  }
}

export default TailInlineTag;