fileChange.tsx 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. const FileChange = ({filename, authors, className}: Props) => (
  14. <FileItem className={className}>
  15. <Filename>
  16. <StyledFileIcon fileName={filename} />
  17. <TextOverflow>{filename}</TextOverflow>
  18. </Filename>
  19. <div>
  20. <AvatarList users={authors as AvatarUser[]} avatarSize={25} typeMembers="authors" />
  21. </div>
  22. </FileItem>
  23. );
  24. const FileItem = styled(ListGroupItem)`
  25. display: flex;
  26. align-items: center;
  27. justify-content: space-between;
  28. `;
  29. const Filename = styled('div')`
  30. font-size: ${p => p.theme.fontSizeMedium};
  31. display: grid;
  32. gap: ${space(1)};
  33. margin-right: ${space(3)};
  34. align-items: center;
  35. grid-template-columns: max-content 1fr;
  36. `;
  37. const StyledFileIcon = styled(FileIcon)`
  38. color: ${p => p.theme.gray200};
  39. border-radius: 3px;
  40. `;
  41. export default FileChange;