badge.tsx 756 B

123456789101112131415161718192021222324
  1. import BadgeDisplayName from 'sentry/components/idBadge/badgeDisplayName';
  2. import BaseBadge from 'sentry/components/idBadge/baseBadge';
  3. type BaseBadgeProps = React.ComponentProps<typeof BaseBadge>;
  4. type Team = NonNullable<BaseBadgeProps['team']>;
  5. export interface BadgeProps
  6. extends Partial<Omit<BaseBadgeProps, 'project' | 'organization' | 'team'>> {
  7. team: Team;
  8. // If true, will use default max-width, or specify one as a string
  9. hideOverflow?: boolean | string;
  10. }
  11. const Badge = ({hideOverflow = true, team, ...props}: BadgeProps): React.ReactElement => (
  12. <BaseBadge
  13. displayName={
  14. <BadgeDisplayName hideOverflow={hideOverflow}>{`#${team.slug}`}</BadgeDisplayName>
  15. }
  16. team={team}
  17. {...props}
  18. />
  19. );
  20. export default Badge;