feedbackItemSection.tsx 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import type {ReactNode} from 'react';
  2. import styled from '@emotion/styled';
  3. import {space} from 'sentry/styles/space';
  4. const SectionWrapper = styled('section')`
  5. display: flex;
  6. flex-direction: column;
  7. gap: ${space(1)};
  8. `;
  9. const SectionTitle = styled('h3')`
  10. margin: 0;
  11. color: ${p => p.theme.gray300};
  12. font-size: ${p => p.theme.fontSizeMedium};
  13. text-transform: capitalize;
  14. display: flex;
  15. gap: ${space(0.5)};
  16. align-items: center;
  17. justify-content: space-between;
  18. `;
  19. const LeftAlignedContent = styled('div')`
  20. display: flex;
  21. align-items: center;
  22. gap: ${space(0.5)};
  23. `;
  24. export default function Section({
  25. children,
  26. icon,
  27. title,
  28. contentRight,
  29. }: {
  30. children: ReactNode;
  31. contentRight?: ReactNode;
  32. icon?: ReactNode;
  33. title?: ReactNode;
  34. }) {
  35. return (
  36. <SectionWrapper>
  37. {title ? (
  38. <SectionTitle>
  39. <LeftAlignedContent>
  40. {icon}
  41. {title}
  42. </LeftAlignedContent>
  43. {contentRight}
  44. </SectionTitle>
  45. ) : null}
  46. {children}
  47. </SectionWrapper>
  48. );
  49. }