fileChange.tsx 1.4 KB

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