import React, { memo } from 'react';
import classNames from 'classnames';
import styles from './LayerShow.less';

export default memo(function LayerShow({ show, onChange }: { show: boolean; onChange: (param) => any }) {
  const handleClick = (e) => {
    e.stopPropagation();
    onChange(!show);
  };

  return (
    <span className={classNames(styles.showIcon, { [styles.show]: show })} onClick={handleClick}>
      {show && <i className="icon iconfont icon-btn_eyesopen" />}
    </span>
  );
});
