parentLabel.tsx 744 B

12345678910111213141516171819202122232425262728293031
  1. import styled from '@emotion/styled';
  2. import Avatar from 'sentry/components/avatar';
  3. import space from 'sentry/styles/space';
  4. import {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. const ParentLabel = ({notificationType, parent}: Props) => (
  12. <FieldLabel>
  13. <Avatar
  14. {...{
  15. [getParentKey(notificationType)]: parent,
  16. }}
  17. />
  18. <span>{parent.slug}</span>
  19. </FieldLabel>
  20. );
  21. const FieldLabel = styled('div')`
  22. display: flex;
  23. gap: ${space(0.5)};
  24. line-height: 16px;
  25. `;
  26. export default ParentLabel;