import React, { useContext } from 'react';
import { ConfigProvider, Menu, MenuItemProps } from 'antd';
import classNames from 'classnames';
import './style/index.less';

const AntdMenuItem = Menu.Item;

const MenuItem = (props: MenuItemProps) => {
  // 为了与 antd 的生态保持兼容性，我们要求必须要使用 `.@{ant-prefix}` 变量来生成类名
  const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
  const prefixCls = getPrefixCls('btri-menu');
  return (
    <AntdMenuItem {...props} className={classNames(`${prefixCls}-item`)}>
      {props.children}
    </AntdMenuItem>
  );
};
export default MenuItem;
