organizationBadge.tsx 888 B

12345678910111213141516171819202122232425
  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 Organization = NonNullable<BaseBadgeProps['organization']>;
  5. type Props = Partial<Omit<BaseBadgeProps, 'project' | 'organization' | 'team'>> & {
  6. // A full organization is not used, but required to satisfy types with
  7. // withOrganization()
  8. organization: Organization;
  9. // If true, will use default max-width, or specify one as a string
  10. hideOverflow?: boolean | string;
  11. };
  12. const OrganizationBadge = ({hideOverflow = true, organization, ...props}: Props) => (
  13. <BaseBadge
  14. displayName={
  15. <BadgeDisplayName hideOverflow={hideOverflow}>{organization.slug}</BadgeDisplayName>
  16. }
  17. organization={organization}
  18. {...props}
  19. />
  20. );
  21. export default OrganizationBadge;