interimSection.tsx 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 {
  8. FoldSection,
  9. type FoldSectionProps,
  10. } from 'sentry/views/issueDetails/streamline/foldSection';
  11. import {useHasStreamlinedUI} from 'sentry/views/issueDetails/utils';
  12. /**
  13. * This section is meant to provide a shared component while the streamline UI
  14. * for issue details is being developed. Once GA'd, all occurances should be replaced
  15. * with just <FoldSection />
  16. */
  17. export const InterimSection = forwardRef<
  18. HTMLElement,
  19. EventDataSectionProps & Pick<FoldSectionProps, 'initialCollapse' | 'preventCollapse'>
  20. >(function InterimSection(
  21. {children, title, type, actions = null, initialCollapse, preventCollapse, ...props},
  22. ref
  23. ) {
  24. const hasStreamlinedUI = useHasStreamlinedUI();
  25. return hasStreamlinedUI ? (
  26. <FoldSection
  27. sectionKey={type as SectionKey}
  28. title={title}
  29. actions={actions}
  30. ref={ref}
  31. initialCollapse={initialCollapse}
  32. preventCollapse={preventCollapse}
  33. >
  34. {children}
  35. </FoldSection>
  36. ) : (
  37. <EventDataSection title={title} actions={actions} type={type} {...props}>
  38. {children}
  39. </EventDataSection>
  40. );
  41. });