sidebarSection.tsx 948 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import styled from '@emotion/styled';
  2. import space from 'sentry/styles/space';
  3. type Props = {
  4. title: React.ReactNode;
  5. children?: React.ReactNode;
  6. icon?: React.ReactNode;
  7. };
  8. /**
  9. * Used to add the new sidebar section on a page.
  10. */
  11. function SidebarSection({title, children, icon, ...props}: Props) {
  12. return (
  13. <Wrapper>
  14. <Heading {...props}>
  15. {title}
  16. {icon && <IconWrapper>{icon}</IconWrapper>}
  17. </Heading>
  18. <SectionContent>{children}</SectionContent>
  19. </Wrapper>
  20. );
  21. }
  22. const Wrapper = styled('div')`
  23. margin-bottom: ${space(3)};
  24. `;
  25. const Heading = styled('h6')`
  26. color: ${p => p.theme.subText};
  27. display: flex;
  28. font-size: ${p => p.theme.fontSizeMedium};
  29. margin: ${space(1)} 0;
  30. `;
  31. const IconWrapper = styled('div')`
  32. color: ${p => p.theme.subText};
  33. margin-left: ${space(0.5)};
  34. `;
  35. const SectionContent = styled('div')`
  36. color: ${p => p.theme.subText};
  37. `;
  38. export default SidebarSection;