settingsWrapper.tsx 961 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import styled from '@emotion/styled';
  2. import {Location} from 'history';
  3. import useScrollToTop from 'sentry/utils/useScrollToTop';
  4. import {BreadcrumbProvider} from 'sentry/views/settings/components/settingsBreadcrumb/context';
  5. type Props = {
  6. children: React.ReactNode;
  7. location: Location;
  8. };
  9. function scrollDisable(newLocation: Location, prevLocation: Location) {
  10. return newLocation.pathname === prevLocation.pathname;
  11. }
  12. function SettingsWrapper({location, children}: Props) {
  13. useScrollToTop({location, disable: scrollDisable});
  14. return (
  15. <StyledSettingsWrapper>
  16. <BreadcrumbProvider>{children}</BreadcrumbProvider>
  17. </StyledSettingsWrapper>
  18. );
  19. }
  20. export default SettingsWrapper;
  21. const StyledSettingsWrapper = styled('div')`
  22. display: flex;
  23. flex: 1;
  24. font-size: ${p => p.theme.fontSizeMedium};
  25. line-height: ${p => p.theme.text.lineHeightBody};
  26. color: ${p => p.theme.textColor};
  27. .messages-container {
  28. margin: 0;
  29. }
  30. `;