sidebarSectionTitle.tsx 728 B

1234567891011121314151617181920212223242526272829303132333435
  1. import * as React from 'react';
  2. import styled from '@emotion/styled';
  3. import space from 'app/styles/space';
  4. type Props = {
  5. title: React.ReactNode;
  6. icon?: React.ReactNode;
  7. };
  8. /**
  9. * Used to add a new subheading in a sidebar section.
  10. */
  11. function SidebarSectionTitle({title, icon, ...props}: Props) {
  12. return (
  13. <Heading {...props}>
  14. {title}
  15. {icon && <IconWrapper>{icon}</IconWrapper>}
  16. </Heading>
  17. );
  18. }
  19. const Heading = styled('h6')`
  20. color: ${p => p.theme.gray400};
  21. display: flex;
  22. font-size: ${p => p.theme.fontSizeMedium};
  23. margin-bottom: ${space(1)};
  24. `;
  25. const IconWrapper = styled('div')`
  26. color: ${p => p.theme.gray200};
  27. margin-left: ${space(0.5)};
  28. `;
  29. export default SidebarSectionTitle;