interimSection.tsx 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. interface InterimSectionProps extends EventDataSectionProps {
  14. sectionKey: FoldSectionKey;
  15. }
  16. /**
  17. * This section is meant to provide a shared component while the streamline UI
  18. * for issue details is being developed. Once GA'd, all occurances should be replaced
  19. * with just <FoldSection />
  20. */
  21. export function InterimSection({
  22. children,
  23. sectionKey,
  24. title,
  25. actions = null,
  26. ...props
  27. }: InterimSectionProps) {
  28. const hasStreamlinedUI = useHasStreamlinedUI();
  29. return hasStreamlinedUI ? (
  30. <Fragment>
  31. <FoldSection sectionKey={sectionKey} title={title} actions={actions}>
  32. {children}
  33. </FoldSection>
  34. <Divider />
  35. </Fragment>
  36. ) : (
  37. <EventDataSection title={title} actions={actions} {...props}>
  38. {children}
  39. </EventDataSection>
  40. );
  41. }
  42. const Divider = styled('hr')`
  43. border-color: ${p => p.theme.border};
  44. margin: ${space(1)} 0;
  45. &:last-child {
  46. display: none;
  47. }
  48. `;