Convert Tooltip component to JSX (#7516)

feature/default_network_editable
Whymarrh Whitby 5 years ago committed by GitHub
parent 9f7438e756
commit 99e94dadbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 36
      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 (
<ReactTooltip position={position} title={title} fixed>
{children}
</ReactTooltip>
)
}
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

Loading…
Cancel
Save