Convert Tooltip component to JSX (#7516)
parent
9f7438e756
commit
99e94dadbd
@ -1,22 +1,24 @@ |
|||||||
const Component = require('react').Component |
import PropTypes from 'prop-types' |
||||||
const h = require('react-hyperscript') |
import React from 'react' |
||||||
const inherits = require('util').inherits |
import ReactTooltip from 'react-tooltip-component' |
||||||
const ReactTooltip = require('react-tooltip-component') |
|
||||||
|
|
||||||
module.exports = Tooltip |
function Tooltip ({ position, title, children }) { |
||||||
|
return ( |
||||||
inherits(Tooltip, Component) |
<ReactTooltip position={position} title={title} fixed> |
||||||
function Tooltip () { |
{children} |
||||||
Component.call(this) |
</ReactTooltip> |
||||||
|
) |
||||||
} |
} |
||||||
|
|
||||||
Tooltip.prototype.render = function () { |
Tooltip.defaultProps = { |
||||||
const props = this.props |
position: 'left', |
||||||
const { position, title, children } = props |
children: null, |
||||||
|
} |
||||||
|
|
||||||
return h(ReactTooltip, { |
Tooltip.propTypes = { |
||||||
position: position || 'left', |
position: PropTypes.string, |
||||||
title, |
title: PropTypes.string.isRequired, |
||||||
fixed: true, |
children: PropTypes.node, |
||||||
}, children) |
|
||||||
} |
} |
||||||
|
|
||||||
|
module.exports = Tooltip |
||||||
|
Loading…
Reference in new issue