2024-04-08 14:04:08 +08:00
|
|
|
import * as React from 'react';
|
2021-07-19 15:42:07 +08:00
|
|
|
import classNames from 'classnames';
|
|
|
|
import { Divider } from 'rc-menu';
|
2024-04-08 14:04:08 +08:00
|
|
|
|
2021-07-19 15:42:07 +08:00
|
|
|
import { ConfigContext } from '../config-provider';
|
|
|
|
|
|
|
|
export interface MenuDividerProps extends React.HTMLAttributes<HTMLLIElement> {
|
|
|
|
className?: string;
|
|
|
|
prefixCls?: string;
|
|
|
|
style?: React.CSSProperties;
|
|
|
|
dashed?: boolean;
|
|
|
|
}
|
|
|
|
|
2022-11-21 09:52:33 +08:00
|
|
|
const MenuDivider: React.FC<MenuDividerProps> = (props) => {
|
|
|
|
const { prefixCls: customizePrefixCls, className, dashed, ...restProps } = props;
|
2021-07-19 15:42:07 +08:00
|
|
|
const { getPrefixCls } = React.useContext(ConfigContext);
|
|
|
|
|
|
|
|
const prefixCls = getPrefixCls('menu', customizePrefixCls);
|
|
|
|
const classString = classNames(
|
|
|
|
{
|
|
|
|
[`${prefixCls}-item-divider-dashed`]: !!dashed,
|
|
|
|
},
|
|
|
|
className,
|
|
|
|
);
|
|
|
|
|
|
|
|
return <Divider className={classString} {...restProps} />;
|
|
|
|
};
|
|
|
|
|
|
|
|
export default MenuDivider;
|