shortId.tsx 740 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. import styled from '@emotion/styled';
  2. /**
  3. * Used in new inbox
  4. * Renders the project badge and short name
  5. */
  6. type Props = {
  7. shortId: string;
  8. avatar?: React.ReactNode;
  9. };
  10. const ShortId = ({shortId, avatar}: Props) => (
  11. <Wrapper>
  12. <AvatarWrapper>{avatar}</AvatarWrapper>
  13. <IdWrapper>{shortId}</IdWrapper>
  14. </Wrapper>
  15. );
  16. export default ShortId;
  17. const Wrapper = styled('div')`
  18. display: flex;
  19. align-items: center;
  20. white-space: nowrap;
  21. text-overflow: ellipsis;
  22. font-size: ${p => p.theme.fontSizeExtraSmall};
  23. `;
  24. const AvatarWrapper = styled('div')`
  25. margin-right: 3px;
  26. flex-shrink: 0;
  27. `;
  28. const IdWrapper = styled('div')`
  29. overflow: hidden;
  30. text-overflow: ellipsis;
  31. white-space: nowrap;
  32. margin-top: 1px;
  33. `;