taskSidebar.tsx 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. import styled from '@emotion/styled';
  2. import HighlightTopRightPattern from 'sentry-images/pattern/highlight-top-right.svg';
  3. import SidebarPanel from 'sentry/components/sidebar/sidebarPanel';
  4. import pulsingIndicatorStyles from 'sentry/styles/pulsingIndicator';
  5. import {space} from 'sentry/styles/space';
  6. import type {CommonSidebarProps} from './types';
  7. interface TaskSidebarProps
  8. extends Pick<CommonSidebarProps, 'orientation' | 'collapsed' | 'hidePanel'> {
  9. children?: React.ReactNode;
  10. }
  11. export function TaskSidebar(props: TaskSidebarProps) {
  12. const {children, collapsed, hidePanel, orientation} = props;
  13. return (
  14. <TaskSidebarPanel
  15. orientation={orientation}
  16. collapsed={collapsed}
  17. hidePanel={hidePanel}
  18. >
  19. <TopRightBackgroundImage src={HighlightTopRightPattern} />
  20. {children}
  21. </TaskSidebarPanel>
  22. );
  23. }
  24. export const TaskSidebarList = styled('div')`
  25. display: grid;
  26. grid-auto-flow: row;
  27. grid-template-columns: 100%;
  28. gap: ${space(1)};
  29. margin: ${space(1)} ${space(4)} ${space(4)} ${space(4)};
  30. `;
  31. const TaskSidebarPanel = styled(SidebarPanel)`
  32. width: 450px;
  33. `;
  34. const TopRightBackgroundImage = styled('img')`
  35. position: absolute;
  36. top: 0;
  37. right: 0;
  38. width: 60%;
  39. user-select: none;
  40. `;
  41. interface EventIndicatorProps extends React.HTMLAttributes<HTMLDivElement> {
  42. status: 'received' | 'waiting';
  43. }
  44. export const EventIndicator = styled(
  45. ({children, ...props}: React.HTMLAttributes<HTMLDivElement> & EventIndicatorProps) => (
  46. <div {...props}>
  47. {props.status === 'waiting' ? <PulsingIndicator /> : '🎉 '}
  48. {children}
  49. </div>
  50. )
  51. )`
  52. display: flex;
  53. align-items: center;
  54. flex-grow: 1;
  55. font-size: ${p => p.theme.fontSizeMedium};
  56. color: ${p => (p.status === 'waiting' ? p.theme.pink400 : p.theme.green400)};
  57. `;
  58. export const PulsingIndicator = styled('div')`
  59. ${pulsingIndicatorStyles};
  60. margin-right: ${space(1)};
  61. `;