mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
b9b61d4f20
Prepare Dictionary Edit Feature for Release GitOrigin-RevId: 1f17143c5aa89ec7a87c2fd0d35f1de4caabf33b
53 lines
1 KiB
TypeScript
53 lines
1 KiB
TypeScript
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
|
|
phase?: string
|
|
}
|
|
|
|
function BetaBadge({
|
|
tooltip,
|
|
url = '/beta/participate',
|
|
phase = 'beta',
|
|
}: BetaBadgeProps) {
|
|
let badgeClass
|
|
switch (phase) {
|
|
case 'release':
|
|
badgeClass = 'info-badge'
|
|
break
|
|
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={`badge ${badgeClass}`}
|
|
>
|
|
<span className="sr-only">{tooltip.text}</span>
|
|
</a>
|
|
</Tooltip>
|
|
)
|
|
}
|
|
|
|
export default BetaBadge
|