interimSection.tsx 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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'>
  20. >(function InterimSection(
  21. {children, title, type, actions = null, initialCollapse, ...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. >
  33. {children}
  34. </FoldSection>
  35. ) : (
  36. <EventDataSection title={title} actions={actions} type={type} {...props}>
  37. {children}
  38. </EventDataSection>
  39. );
  40. });