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

export interface MenuItemGroupProps {
  title?: React.ReactNode;
  children?: React.ReactNode;
  eventKey?: string;
  warnKey?: boolean;
}

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