//模块标题
/*
style //样式不传默认上面10px
icon  dom节点
title //名称
rightText  //右侧文字
handleRightClick   //右侧点击方法

//使用实例
<ModuleTitle title='数据曲线' icon={<img src={require('@/assets/newUI/icon_in.png')} />} />
<ModuleTitle title='数据曲线' icon={<Icon style={{ color: 'yellow' }} type="bulb" />} />
*/
import styles from './index.less';
const ModuleTitle = ({ style, icon, title, rightText, handleRightClick }) => {
  return (
    <div style={style ? style : { margin: '10px 0', paddingRight: '10px' }}>
      {icon ? icon : <div className={styles.icon} />}
      <span className={styles.title}>{title}</span>
      {rightText && (
        <span className={styles.right} onClick={() => handleRightClick?.()}>
          {rightText}
        </span>
      )}
    </div>
  );
};

export default ModuleTitle;
