2022-05-18 09:46:10 -04:00
|
|
|
import Tooltip from './tooltip'
|
|
|
|
import { OverlayTriggerProps } from 'react-bootstrap'
|
|
|
|
|
|
|
|
type TooltipProps = {
|
|
|
|
id: string
|
|
|
|
text: React.ReactNode
|
|
|
|
placement?: OverlayTriggerProps['placement']
|
|
|
|
className?: string
|
|
|
|
}
|
|
|
|
|
|
|
|
type BetaBadgeProps = {
|
|
|
|
tooltip: TooltipProps
|
|
|
|
url?: string
|
2022-06-22 05:34:42 -04:00
|
|
|
phase?: string
|
2022-05-18 09:46:10 -04:00
|
|
|
}
|
|
|
|
|
2022-06-22 05:34:42 -04:00
|
|
|
function BetaBadge({
|
|
|
|
tooltip,
|
|
|
|
url = '/beta/participate',
|
|
|
|
phase = 'beta',
|
|
|
|
}: BetaBadgeProps) {
|
|
|
|
let badgeClass
|
|
|
|
switch (phase) {
|
|
|
|
case 'release':
|
|
|
|
badgeClass = 'info-badge'
|
|
|
|
break
|
|
|
|
default:
|
|
|
|
badgeClass = 'beta-badge'
|
|
|
|
}
|
|
|
|
|
2022-05-18 09:46:10 -04:00
|
|
|
return (
|
|
|
|
<Tooltip
|
|
|
|
id={tooltip.id}
|
|
|
|
description={tooltip.text}
|
|
|
|
tooltipProps={{ className: tooltip.className }}
|
|
|
|
overlayProps={{
|
|
|
|
placement: tooltip.placement || 'bottom',
|
|
|
|
delayHide: 100,
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<a
|
|
|
|
href={url}
|
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer"
|
2022-06-22 05:34:42 -04:00
|
|
|
className={`badge ${badgeClass}`}
|
2022-05-18 09:46:10 -04:00
|
|
|
>
|
|
|
|
<span className="sr-only">{tooltip.text}</span>
|
|
|
|
</a>
|
|
|
|
</Tooltip>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default BetaBadge
|