overleaf/services/web/frontend/js/shared/components/beta-badge.js
Alf Eaton 5e9af2c15c Migrate worker tests to Cypress (#7359)
GitOrigin-RevId: f373f4215e5f25d14256008cf5f6582eb3124431
2022-04-07 08:03:52 +00:00

35 lines
905 B
JavaScript

import { OverlayTrigger, Tooltip } from 'react-bootstrap'
import PropTypes from 'prop-types'
export default function BetaBadge({ tooltip, url = '/beta/participate' }) {
return (
<OverlayTrigger
placement={tooltip.placement || 'bottom'}
overlay={
<Tooltip id={tooltip.id} className={tooltip.className}>
{tooltip.text}
</Tooltip>
}
delayHide={100}
>
<a
href={url}
target="_blank"
rel="noopener noreferrer"
className="badge beta-badge"
>
<span className="sr-only">{tooltip.text}</span>
</a>
</OverlayTrigger>
)
}
BetaBadge.propTypes = {
tooltip: PropTypes.shape({
id: PropTypes.string.isRequired,
text: PropTypes.oneOfType([PropTypes.string, PropTypes.object]).isRequired,
placement: PropTypes.string,
className: PropTypes.string,
}),
url: PropTypes.string,
}