ant-design/components/tooltip/index.jsx

29 lines
626 B
React
Raw Normal View History

import React from 'react';
import Tooltip from 'rc-tooltip';
2015-06-03 17:08:43 +08:00
export default React.createClass({
2015-06-17 17:15:34 +08:00
getDefaultProps() {
2015-06-03 17:08:43 +08:00
return {
placement: 'top'
};
},
2015-06-17 17:15:34 +08:00
render() {
var transitionName = ({
top: 'zoom-down',
bottom: 'zoom-up',
left: 'zoom-right',
right: 'zoom-left'
})[this.props.placement];
2015-06-10 17:59:32 +08:00
return (
2015-06-09 17:44:22 +08:00
<Tooltip placement={this.props.placement}
2015-06-09 16:40:16 +08:00
prefixCls="ant-tooltip"
2015-07-08 16:29:57 +08:00
delay={0.1}
2015-06-10 22:11:58 +08:00
trigger={this.props.trigger}
2015-06-17 17:15:34 +08:00
transitionName={transitionName}
2015-06-09 17:44:22 +08:00
overlay={this.props.title}>
2015-06-03 17:08:43 +08:00
{this.props.children}
</Tooltip>
);
}
});