import React from 'react';
import { Command } from 'gg-editor';
import upperFirst from 'lodash/upperFirst';
import IconFont from '../../common/IconFont';
import styles from './index.less';

const getIsDelete = (props) => {
  if (props.command == 'delete') {
    // props.isDelete(true)
    props.isDelete.isDelete(true)
  }
}
const MenuItem = (props) => {
  const { command, icon, text, isDelete } = props;
  return (
    <Command name={command} >
      <div onClick={() => { getIsDelete(props) }} className={styles.item}>
        <IconFont type={`icon-${icon || command}`} />
        <span>{text || upperFirst(command)}</span>
      </div>
    </Command>
  );
};

export default MenuItem;
