From 99e94dadbdea4c80b192c4116b8b0f4712be65ef Mon Sep 17 00:00:00 2001 From: Whymarrh Whitby Date: Sat, 23 Nov 2019 12:51:59 -0330 Subject: [PATCH] Convert Tooltip component to JSX (#7516) --- ui/app/components/ui/tooltip.js | 36 +++++++++++++++++---------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/ui/app/components/ui/tooltip.js b/ui/app/components/ui/tooltip.js index efab2c497..aa98ac18a 100644 --- a/ui/app/components/ui/tooltip.js +++ b/ui/app/components/ui/tooltip.js @@ -1,22 +1,24 @@ -const Component = require('react').Component -const h = require('react-hyperscript') -const inherits = require('util').inherits -const ReactTooltip = require('react-tooltip-component') +import PropTypes from 'prop-types' +import React from 'react' +import ReactTooltip from 'react-tooltip-component' -module.exports = Tooltip - -inherits(Tooltip, Component) -function Tooltip () { - Component.call(this) +function Tooltip ({ position, title, children }) { + return ( + + {children} + + ) } -Tooltip.prototype.render = function () { - const props = this.props - const { position, title, children } = props +Tooltip.defaultProps = { + position: 'left', + children: null, +} - return h(ReactTooltip, { - position: position || 'left', - title, - fixed: true, - }, children) +Tooltip.propTypes = { + position: PropTypes.string, + title: PropTypes.string.isRequired, + children: PropTypes.node, } + +module.exports = Tooltip