parentLabel.tsx 779 B

123456789101112131415161718192021222324252627282930313233
  1. import styled from '@emotion/styled';
  2. import Avatar from 'sentry/components/avatar';
  3. import {space} from 'sentry/styles/space';
  4. import type {OrganizationSummary, Project} from 'sentry/types';
  5. import {getParentKey} from 'sentry/views/settings/account/notifications/utils';
  6. type Props = {
  7. notificationType: string;
  8. parent: OrganizationSummary | Project;
  9. };
  10. // TODO(mgaeta): Infer parentKey from parent.
  11. function ParentLabel({notificationType, parent}: Props) {
  12. return (
  13. <FieldLabel>
  14. <Avatar
  15. {...{
  16. [getParentKey(notificationType)]: parent,
  17. }}
  18. />
  19. <span>{parent.slug}</span>
  20. </FieldLabel>
  21. );
  22. }
  23. const FieldLabel = styled('div')`
  24. display: flex;
  25. gap: ${space(0.5)};
  26. line-height: 16px;
  27. `;
  28. export default ParentLabel;