mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
e95ad3e71b
GitOrigin-RevId: b8029b65c95ccdac89587d484e2599e25fe44302
53 lines
1.1 KiB
TypeScript
53 lines
1.1 KiB
TypeScript
import type { FC, ReactNode } from 'react'
|
|
import classnames from 'classnames'
|
|
import Tooltip from './tooltip'
|
|
import { OverlayTriggerProps } from 'react-bootstrap'
|
|
|
|
type TooltipProps = {
|
|
id: string
|
|
text: ReactNode
|
|
placement?: OverlayTriggerProps['placement']
|
|
className?: string
|
|
}
|
|
|
|
const BetaBadge: FC<{
|
|
tooltip: TooltipProps
|
|
url?: string
|
|
phase?: string
|
|
}> = ({ tooltip, url = '/beta/participate', phase = 'beta' }) => {
|
|
let badgeClass
|
|
switch (phase) {
|
|
case 'release':
|
|
badgeClass = 'info-badge'
|
|
break
|
|
case 'alpha':
|
|
badgeClass = 'alpha-badge'
|
|
break
|
|
case 'beta':
|
|
default:
|
|
badgeClass = 'beta-badge'
|
|
}
|
|
|
|
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"
|
|
className={classnames('badge', badgeClass)}
|
|
>
|
|
<span className="sr-only">{tooltip.text}</span>
|
|
</a>
|
|
</Tooltip>
|
|
)
|
|
}
|
|
|
|
export default BetaBadge
|