interimSection.tsx 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import {forwardRef} from 'react';
  2. import {
  3. EventDataSection,
  4. type EventDataSectionProps,
  5. } from 'sentry/components/events/eventDataSection';
  6. import type {SectionKey} from 'sentry/views/issueDetails/streamline/context';
  7. import {FoldSection} from 'sentry/views/issueDetails/streamline/foldSection';
  8. import {useHasStreamlinedUI} from 'sentry/views/issueDetails/utils';
  9. /**
  10. * This section is meant to provide a shared component while the streamline UI
  11. * for issue details is being developed. Once GA'd, all occurances should be replaced
  12. * with just <FoldSection />
  13. */
  14. export const InterimSection = forwardRef<HTMLElement, EventDataSectionProps>(
  15. function InterimSection(
  16. {children, title, type, actions = null, ...props}: EventDataSectionProps,
  17. ref
  18. ) {
  19. const hasStreamlinedUI = useHasStreamlinedUI();
  20. return hasStreamlinedUI ? (
  21. <FoldSection
  22. sectionKey={type as SectionKey}
  23. title={title}
  24. actions={actions}
  25. ref={ref}
  26. >
  27. {children}
  28. </FoldSection>
  29. ) : (
  30. <EventDataSection title={title} actions={actions} type={type} {...props}>
  31. {children}
  32. </EventDataSection>
  33. );
  34. }
  35. );