fileChange.tsx 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import styled from '@emotion/styled';
  2. import AvatarList from 'sentry/components/avatar/avatarList';
  3. import {ListGroupItem} from 'sentry/components/listGroup';
  4. import TextOverflow from 'sentry/components/textOverflow';
  5. import {space} from 'sentry/styles/space';
  6. import type {CommitAuthor} from 'sentry/types/integrations';
  7. import type {AvatarUser} from 'sentry/types/user';
  8. import FileIcon from './fileIcon';
  9. interface FileChangeProps {
  10. authors: CommitAuthor[];
  11. filename: string;
  12. }
  13. function FileChange({filename, authors}: FileChangeProps) {
  14. return (
  15. <FileItem>
  16. <Filename>
  17. <FileIconWrapper>
  18. <FileIcon fileName={filename} />
  19. </FileIconWrapper>
  20. <TextOverflow>{filename}</TextOverflow>
  21. </Filename>
  22. <AvatarList users={authors as AvatarUser[]} avatarSize={25} typeAvatars="authors" />
  23. </FileItem>
  24. );
  25. }
  26. const FileItem = styled(ListGroupItem)`
  27. display: flex;
  28. align-items: center;
  29. justify-content: space-between;
  30. gap: ${space(3)};
  31. border-radius: 0;
  32. border-left: none;
  33. border-right: none;
  34. border-top: none;
  35. :last-child {
  36. border: none;
  37. border-radius: 0;
  38. }
  39. `;
  40. const Filename = styled('div')`
  41. font-size: ${p => p.theme.fontSizeMedium};
  42. display: grid;
  43. grid-template-columns: max-content 1fr;
  44. gap: ${space(1)};
  45. align-items: center;
  46. `;
  47. const FileIconWrapper = styled('div')`
  48. display: flex;
  49. align-items: center;
  50. color: ${p => p.theme.gray200};
  51. border-radius: 3px;
  52. `;
  53. export default FileChange;