styles.tsx 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. import {useMemo} from 'react';
  2. import styled from '@emotion/styled';
  3. import * as qs from 'query-string';
  4. import {Button as CommonButton, LinkButton} from 'sentry/components/button';
  5. import {DataSection} from 'sentry/components/events/styles';
  6. import {t} from 'sentry/locale';
  7. import {space} from 'sentry/styles/space';
  8. const DetailContainer = styled('div')`
  9. display: flex;
  10. flex-direction: column;
  11. gap: ${space(2)};
  12. padding: ${space(1)};
  13. ${DataSection} {
  14. padding: 0;
  15. }
  16. `;
  17. const FlexBox = styled('div')`
  18. display: flex;
  19. align-items: center;
  20. `;
  21. const Actions = styled(FlexBox)`
  22. gap: ${space(0.5)};
  23. `;
  24. const Title = styled(FlexBox)`
  25. gap: ${space(1)};
  26. flex: none;
  27. `;
  28. const Type = styled('div')`
  29. font-size: ${p => p.theme.fontSizeSmall};
  30. `;
  31. const TitleOp = styled('div')`
  32. font-size: 15px;
  33. font-weight: bold;
  34. max-width: 600px;
  35. ${p => p.theme.overflowEllipsis}
  36. `;
  37. const Table = styled('table')`
  38. margin-bottom: 0 !important;
  39. `;
  40. const IconTitleWrapper = styled(FlexBox)`
  41. gap: ${space(1)};
  42. `;
  43. const IconBorder = styled('div')<{backgroundColor: string; errored?: boolean}>`
  44. background-color: ${p => p.backgroundColor};
  45. border-radius: ${p => p.theme.borderRadius};
  46. padding: 0;
  47. display: flex;
  48. align-items: center;
  49. justify-content: center;
  50. width: 30px;
  51. height: 30px;
  52. svg {
  53. fill: ${p => p.theme.white};
  54. width: 14px;
  55. height: 14px;
  56. }
  57. `;
  58. const Button = styled(CommonButton)`
  59. position: absolute;
  60. top: ${space(0.75)};
  61. right: ${space(0.5)};
  62. `;
  63. const HeaderContainer = styled(Title)`
  64. justify-content: space-between;
  65. `;
  66. function EventDetailsLink(props: {eventId: string; projectSlug?: string}) {
  67. const query = useMemo(() => {
  68. return {...qs.parse(location.search), legacy: 1};
  69. }, []);
  70. return (
  71. <LinkButton
  72. disabled={!props.eventId || !props.projectSlug}
  73. title={
  74. !props.eventId || !props.projectSlug
  75. ? t('Event ID or Project Slug missing')
  76. : undefined
  77. }
  78. size="xs"
  79. to={{
  80. pathname: `/performance/${props.projectSlug}:${props.eventId}/`,
  81. query: query,
  82. }}
  83. >
  84. {t('View Event Details')}
  85. </LinkButton>
  86. );
  87. }
  88. const TraceDrawerComponents = {
  89. DetailContainer,
  90. FlexBox,
  91. Title,
  92. Type,
  93. TitleOp,
  94. HeaderContainer,
  95. Actions,
  96. Table,
  97. IconTitleWrapper,
  98. IconBorder,
  99. EventDetailsLink,
  100. Button,
  101. };
  102. export {TraceDrawerComponents};