mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-26 12:29:06 +01:00
Convert Tooltip component to JSX (#7516)
This commit is contained in:
parent
9f7438e756
commit
99e94dadbd
@ -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'
|
||||
|
||||
function Tooltip ({ position, title, children }) {
|
||||
return (
|
||||
<ReactTooltip position={position} title={title} fixed>
|
||||
{children}
|
||||
</ReactTooltip>
|
||||
)
|
||||
}
|
||||
|
||||
Tooltip.defaultProps = {
|
||||
position: 'left',
|
||||
children: null,
|
||||
}
|
||||
|
||||
Tooltip.propTypes = {
|
||||
position: PropTypes.string,
|
||||
title: PropTypes.string.isRequired,
|
||||
children: PropTypes.node,
|
||||
}
|
||||
|
||||
module.exports = Tooltip
|
||||
|
||||
inherits(Tooltip, Component)
|
||||
function Tooltip () {
|
||||
Component.call(this)
|
||||
}
|
||||
|
||||
Tooltip.prototype.render = function () {
|
||||
const props = this.props
|
||||
const { position, title, children } = props
|
||||
|
||||
return h(ReactTooltip, {
|
||||
position: position || 'left',
|
||||
title,
|
||||
fixed: true,
|
||||
}, children)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user