overleaf-cep/services/web/frontend/js/shared/components/beta-badge-icon.tsx
Tim Down 34be8b75ad Merge pull request #24936 from overleaf/td-warning-badge-light
Use dark-on-light for warning badge by default

GitOrigin-RevId: 6259ec08c9c31f54dbdad6261a966f638303cc3b
2025-04-17 08:04:46 +00:00

34 lines
840 B
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import type { FC } from 'react'
import MaterialIcon from '@/shared/components/material-icon'
import OLBadge from '@/features/ui/components/ol/ol-badge'
const BetaBadgeIcon: FC<{
phase?: string
}> = ({ phase = 'beta' }) => {
const badgeClass = chooseBadgeClass(phase)
if (badgeClass === 'info-badge') {
return <MaterialIcon type="info" className="align-middle info-badge" />
} else if (badgeClass === 'alpha-badge') {
return (
<OLBadge bg="primary" className="alpha-badge">
α
</OLBadge>
)
} else {
return <OLBadge bg="warning">β</OLBadge>
}
}
function chooseBadgeClass(phase?: string) {
switch (phase) {
case 'release':
return 'info-badge'
case 'alpha':
return 'alpha-badge'
case 'beta':
default:
return 'beta-badge'
}
}
export default BetaBadgeIcon