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

const AntdSubMenu = Menu.SubMenu;
const SubMenu = (props: SubMenuProps) => {
  // 为了与 antd 的生态保持兼容性，我们要求必须要使用 `.@{ant-prefix}` 变量来生成类名
  const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
  const prefixCls = getPrefixCls('btri-menu');

  return (
    <AntdSubMenu
      {...props}
      className={classNames(`${prefixCls}-subMenu`)}
    ></AntdSubMenu>
  );
};
export default SubMenu;
