fileChange.tsx 1.2 KB

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