2015-06-17 16:58:13 +08:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var React = require('react');
|
|
|
|
var Tooltip = require('rc-tooltip');
|
|
|
|
|
|
|
|
module.exports = React.createClass({
|
|
|
|
getDefaultProps: function () {
|
|
|
|
return {
|
2015-06-17 17:10:10 +08:00
|
|
|
transitionName: '',
|
2015-06-17 16:58:13 +08:00
|
|
|
placement: 'top',
|
|
|
|
trigger: 'hover'
|
|
|
|
};
|
|
|
|
},
|
|
|
|
render: function() {
|
|
|
|
var overlay = <div>
|
|
|
|
<div className="popover-title">
|
|
|
|
{this.props.title}
|
|
|
|
</div>
|
|
|
|
<div className="popover-content">
|
|
|
|
{this.props.overlay}
|
|
|
|
</div>
|
|
|
|
</div>;
|
2015-06-17 17:10:10 +08:00
|
|
|
|
|
|
|
var transitionName = ({
|
|
|
|
top: 'zoom-down',
|
|
|
|
bottom: 'zoom-up',
|
|
|
|
left: 'zoom-right',
|
|
|
|
right: 'zoom-left'
|
|
|
|
})[this.props.placement];
|
|
|
|
|
2015-06-17 16:58:13 +08:00
|
|
|
return (
|
|
|
|
<Tooltip placement={this.props.placement}
|
|
|
|
prefixCls="popover"
|
|
|
|
renderPopupToBody={false}
|
2015-06-17 17:10:10 +08:00
|
|
|
transitionName={transitionName}
|
2015-06-17 16:58:13 +08:00
|
|
|
trigger={this.props.trigger}
|
|
|
|
overlay={overlay}>
|
|
|
|
{this.props.children}
|
|
|
|
</Tooltip>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|