ant-design/components/menu/MenuItem.tsx

25 lines
554 B
TypeScript
Raw Normal View History

2017-06-30 21:07:01 +08:00
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,
};
MenuItem.isMenuItem = 1;
2017-06-30 21:07:01 +08:00
export default MenuItem;