interimSection.tsx 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import {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 function InterimSection({
  19. children,
  20. title,
  21. type,
  22. actions = null,
  23. ...props
  24. }: EventDataSectionProps) {
  25. const hasStreamlinedUI = useHasStreamlinedUI();
  26. return hasStreamlinedUI ? (
  27. <Fragment>
  28. <FoldSection sectionKey={type as FoldSectionKey} title={title} actions={actions}>
  29. {children}
  30. </FoldSection>
  31. <Divider />
  32. </Fragment>
  33. ) : (
  34. <EventDataSection title={title} actions={actions} type={type} {...props}>
  35. {children}
  36. </EventDataSection>
  37. );
  38. }
  39. const Divider = styled('hr')`
  40. border-color: ${p => p.theme.border};
  41. margin: ${space(1)} 0;
  42. &:last-child {
  43. display: none;
  44. }
  45. `;