mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-23 06:58:33 +08:00
23 lines
528 B
TypeScript
23 lines
528 B
TypeScript
|
import React from 'react';
|
||
|
import { Item } from 'rc-menu';
|
||
|
import PropTypes from 'prop-types';
|
||
|
import Tooltip from '../tooltip';
|
||
|
|
||
|
const MenuItem: any = (props, { inlineCollapsed }) => {
|
||
|
return (
|
||
|
<Tooltip
|
||
|
title={inlineCollapsed && props.level === 1 ? props.children : ''}
|
||
|
placement="right"
|
||
|
overlayClassName={`${props.rootPrefixCls}-inline-collapsed-tooltip`}
|
||
|
>
|
||
|
<Item {...props} />
|
||
|
</Tooltip>
|
||
|
);
|
||
|
};
|
||
|
|
||
|
MenuItem.contextTypes = {
|
||
|
inlineCollapsed: PropTypes.bool,
|
||
|
};
|
||
|
|
||
|
export default MenuItem;
|