import type {ReactElement} from 'react'; import {Fragment} from 'react'; import styled from '@emotion/styled'; import {Badge} from 'sentry/components/core/badge'; import {FeatureBadge} from 'sentry/components/core/badge/featureBadge'; import HookOrDefault from 'sentry/components/hookOrDefault'; import {SecondaryNav} from 'sentry/components/nav/secondary'; import {Tooltip} from 'sentry/components/tooltip'; import {t} from 'sentry/locale'; import {space} from 'sentry/styles/space'; type Props = { label: React.ReactNode; to: string; badge?: string | number | null | ReactElement; id?: string; index?: boolean; onClick?: (e: React.MouseEvent) => void; }; const LabelHook = HookOrDefault({ hookName: 'sidebar:item-label', defaultComponent: ({children}) => {children}, }); function SettingsNavBadge({badge}: {badge: string | number | null | ReactElement}) { if (badge === 'new' || badge === 'beta' || badge === 'alpha') { return ; } if (badge === 'warning') { return ( {badge} ); } if (typeof badge === 'string' || typeof badge === 'number') { return {badge}; } return badge; } function SettingsNavItem({badge, label, id, to, index, ...props}: Props) { return ( : null} {...props} > {label} ); } const StyledBadge = styled(Badge)` font-weight: ${p => p.theme.fontWeightNormal}; height: auto; line-height: 1; font-size: ${p => p.theme.fontSizeExtraSmall}; padding: 3px ${space(0.75)}; vertical-align: middle; `; export default SettingsNavItem;