newIssue.tsx 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. import {Fragment} from 'react';
  2. import styled from '@emotion/styled';
  3. import EventOrGroupHeader from 'sentry/components/eventOrGroupHeader';
  4. import TimeSince from 'sentry/components/timeSince';
  5. import {IconClock} from 'sentry/icons';
  6. import {t} from 'sentry/locale';
  7. import space from 'sentry/styles/space';
  8. import {Organization} from 'sentry/types';
  9. import {Event} from 'sentry/types/event';
  10. type Props = {
  11. eventCount: number;
  12. organization: Organization;
  13. sampleEvent: Event;
  14. };
  15. function NewIssue({sampleEvent, eventCount, organization}: Props) {
  16. return (
  17. <Fragment>
  18. <EventDetails>
  19. <EventOrGroupHeader
  20. data={sampleEvent}
  21. organization={organization}
  22. grouping
  23. hideIcons
  24. hideLevel
  25. source="new-issue"
  26. />
  27. <ExtraInfo>
  28. <TimeWrapper>
  29. <StyledIconClock legacySize="11px" />
  30. <TimeSince
  31. date={
  32. sampleEvent.dateCreated
  33. ? sampleEvent.dateCreated
  34. : sampleEvent.dateReceived
  35. }
  36. suffix={t('old')}
  37. />
  38. </TimeWrapper>
  39. </ExtraInfo>
  40. </EventDetails>
  41. <EventCount>{eventCount}</EventCount>
  42. </Fragment>
  43. );
  44. }
  45. export default NewIssue;
  46. const EventDetails = styled('div')`
  47. overflow: hidden;
  48. line-height: 1.1;
  49. `;
  50. const ExtraInfo = styled('div')`
  51. display: grid;
  52. grid-auto-flow: column;
  53. gap: ${space(2)};
  54. justify-content: flex-start;
  55. `;
  56. const TimeWrapper = styled('div')`
  57. display: grid;
  58. gap: ${space(0.5)};
  59. grid-template-columns: max-content 1fr;
  60. align-items: center;
  61. font-size: ${p => p.theme.fontSizeSmall};
  62. `;
  63. const EventCount = styled('div')`
  64. align-items: center;
  65. font-variant-numeric: tabular-nums;
  66. line-height: 1.1;
  67. `;
  68. const StyledIconClock = styled(IconClock)`
  69. color: ${p => p.theme.subText};
  70. `;