header.tsx 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import styled from '@emotion/styled';
  2. import Clipboard from 'sentry/components/clipboard';
  3. import {IconCopy} from 'sentry/icons';
  4. import {t} from 'sentry/locale';
  5. import space from 'sentry/styles/space';
  6. import {getShortEventId} from 'sentry/utils/events';
  7. type Props = {
  8. traceID?: string;
  9. };
  10. const Header = ({traceID}: Props) => (
  11. <Wrapper>
  12. <h4>{t('Issues with the same trace ID')}</h4>
  13. {traceID ? (
  14. <Clipboard value={traceID}>
  15. <ClipboardWrapper>
  16. <span>{getShortEventId(traceID)}</span>
  17. <IconCopy />
  18. </ClipboardWrapper>
  19. </Clipboard>
  20. ) : (
  21. <span>{'-'}</span>
  22. )}
  23. </Wrapper>
  24. );
  25. export default Header;
  26. const Wrapper = styled('div')`
  27. display: grid;
  28. grid-template-columns: max-content 1fr;
  29. gap: ${space(1)};
  30. align-items: center;
  31. font-size: ${p => p.theme.headerFontSize};
  32. color: ${p => p.theme.gray300};
  33. h4 {
  34. font-size: ${p => p.theme.headerFontSize};
  35. color: ${p => p.theme.textColor};
  36. font-weight: normal;
  37. margin-bottom: 0;
  38. }
  39. `;
  40. const ClipboardWrapper = styled('div')`
  41. display: grid;
  42. grid-template-columns: max-content 1fr;
  43. gap: ${space(1)};
  44. align-items: center;
  45. &:hover {
  46. cursor: pointer;
  47. }
  48. `;