sidebarSection.tsx 982 B

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