mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-25 16:58:00 +08:00
8bde0c0fee
* ReWrite MenuItem to remove ref warning for react 16 * unified coding style * add removing semicolon
25 lines
635 B
TypeScript
25 lines
635 B
TypeScript
import React from 'react';
|
|
import { Item } from 'rc-menu';
|
|
import PropTypes from 'prop-types';
|
|
import Tooltip from '../tooltip';
|
|
|
|
class MenuItem extends React.Component<any, any> {
|
|
static contextTypes = {
|
|
inlineCollapsed: PropTypes.bool,
|
|
};
|
|
static isMenuItem = 1;
|
|
render() {
|
|
const { inlineCollapsed } = this.context;
|
|
const props = this.props;
|
|
return <Tooltip
|
|
title={inlineCollapsed && props.level === 1 ? props.children : ''}
|
|
placement="right"
|
|
overlayClassName={`${props.rootPrefixCls}-inline-collapsed-tooltip`}
|
|
>
|
|
<Item {...props} />
|
|
</Tooltip>;
|
|
}
|
|
}
|
|
|
|
export default MenuItem;
|