rowDivider.tsx 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. import styled from '@emotion/styled';
  2. import {IconAdd, IconFire, IconSubtract} from 'sentry/icons';
  3. import space from 'sentry/styles/space';
  4. import {Aliases, Color} from 'sentry/utils/theme';
  5. export const DividerContainer = styled('div')`
  6. position: relative;
  7. min-width: 1px;
  8. `;
  9. export const DividerLine = styled('div')<{showDetail?: boolean}>`
  10. background-color: ${p => (p.showDetail ? p.theme.textColor : p.theme.border)};
  11. position: absolute;
  12. height: 100%;
  13. width: 1px;
  14. transition: background-color 125ms ease-in-out;
  15. z-index: ${p => p.theme.zIndex.traceView.dividerLine};
  16. /* enhanced hit-box */
  17. &:after {
  18. content: '';
  19. z-index: -1;
  20. position: absolute;
  21. left: -2px;
  22. top: 0;
  23. width: 5px;
  24. height: 100%;
  25. }
  26. &.hovering {
  27. background-color: ${p => p.theme.textColor};
  28. width: 3px;
  29. transform: translateX(-1px);
  30. margin-right: -2px;
  31. cursor: ew-resize;
  32. &:after {
  33. left: -2px;
  34. width: 7px;
  35. }
  36. }
  37. `;
  38. export const DividerLineGhostContainer = styled('div')`
  39. position: absolute;
  40. width: 100%;
  41. height: 100%;
  42. `;
  43. const BadgeBorder = styled('div')<{borderColor: Color | keyof Aliases}>`
  44. position: absolute;
  45. margin: ${space(0.25)};
  46. left: -11px;
  47. background: ${p => p.theme.background};
  48. width: ${space(3)};
  49. height: ${space(3)};
  50. border: 1px solid ${p => p.theme[p.borderColor]};
  51. border-radius: 50%;
  52. z-index: ${p => p.theme.zIndex.traceView.dividerLine};
  53. display: flex;
  54. align-items: center;
  55. justify-content: center;
  56. `;
  57. export function ErrorBadge() {
  58. return (
  59. <BadgeBorder borderColor="red300">
  60. <IconFire color="red300" size="xs" />
  61. </BadgeBorder>
  62. );
  63. }
  64. export function EmbeddedTransactionBadge({
  65. expanded,
  66. onClick,
  67. }: {
  68. expanded: boolean;
  69. onClick: () => void;
  70. }) {
  71. return (
  72. <BadgeBorder
  73. data-test-id="embedded-transaction-badge"
  74. borderColor="border"
  75. onClick={event => {
  76. event.stopPropagation();
  77. event.preventDefault();
  78. onClick();
  79. }}
  80. >
  81. {expanded ? (
  82. <IconSubtract color="textColor" size="xs" />
  83. ) : (
  84. <IconAdd color="textColor" size="xs" />
  85. )}
  86. </BadgeBorder>
  87. );
  88. }