bubble.tsx 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import styled from '@emotion/styled';
  2. export interface ActivityBubbleProps extends React.HTMLAttributes<HTMLDivElement> {
  3. backgroundColor?: string;
  4. borderColor?: string;
  5. }
  6. /**
  7. * This creates a bordered box that has a left pointing arrow
  8. * on the left-side at the top.
  9. */
  10. const ActivityBubble = styled('div')<ActivityBubbleProps>`
  11. flex: 1;
  12. background-color: ${p => p.backgroundColor || p.theme.background};
  13. border: 1px solid ${p => p.borderColor || p.theme.border};
  14. border-radius: ${p => p.theme.borderRadius};
  15. position: relative;
  16. width: 100%; /* this is used in Incidents Details - a chart can cause overflow and won't resize properly */
  17. &:before {
  18. display: block;
  19. content: '';
  20. width: 0;
  21. height: 0;
  22. border-top: 7px solid transparent;
  23. border-bottom: 7px solid transparent;
  24. border-right: 7px solid ${p => p.borderColor || p.theme.border};
  25. position: absolute;
  26. left: -7px;
  27. top: 12px;
  28. }
  29. &:after {
  30. display: block;
  31. content: '';
  32. width: 0;
  33. height: 0;
  34. border-top: 6px solid transparent;
  35. border-bottom: 6px solid transparent;
  36. border-right: 6px solid ${p => p.backgroundColor || p.theme.background};
  37. position: absolute;
  38. left: -6px;
  39. top: 13px;
  40. }
  41. `;
  42. export default ActivityBubble;