interimSection.tsx 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import {forwardRef, Fragment} from 'react';
  2. import styled from '@emotion/styled';
  3. import {
  4. EventDataSection,
  5. type EventDataSectionProps,
  6. } from 'sentry/components/events/eventDataSection';
  7. import {space} from 'sentry/styles/space';
  8. import {
  9. FoldSection,
  10. type FoldSectionKey,
  11. } from 'sentry/views/issueDetails/streamline/foldSection';
  12. import {useHasStreamlinedUI} from 'sentry/views/issueDetails/utils';
  13. /**
  14. * This section is meant to provide a shared component while the streamline UI
  15. * for issue details is being developed. Once GA'd, all occurances should be replaced
  16. * with just <FoldSection />
  17. */
  18. export const InterimSection = forwardRef<HTMLElement, EventDataSectionProps>(
  19. function InterimSection(
  20. {children, title, type, actions = null, ...props}: EventDataSectionProps,
  21. ref
  22. ) {
  23. const hasStreamlinedUI = useHasStreamlinedUI();
  24. return hasStreamlinedUI ? (
  25. <Fragment>
  26. <FoldSection
  27. sectionKey={type as FoldSectionKey}
  28. title={title}
  29. actions={actions}
  30. ref={ref}
  31. >
  32. {children}
  33. </FoldSection>
  34. <SectionDivider />
  35. </Fragment>
  36. ) : (
  37. <EventDataSection title={title} actions={actions} type={type} {...props}>
  38. {children}
  39. </EventDataSection>
  40. );
  41. }
  42. );
  43. export const SectionDivider = styled('hr')`
  44. border-color: ${p => p.theme.border};
  45. margin: ${space(1)} 0;
  46. &:last-child {
  47. display: none;
  48. }
  49. `;