fileChange.tsx 1.3 KB

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