Skip to content

Commit

Permalink
fix: header not sticky sometimes
Browse files Browse the repository at this point in the history
  • Loading branch information
chybisov committed Jun 1, 2022
1 parent a8f9c35 commit f045008
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions packages/widget/src/components/AppContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Box, ScopedCssBaseline } from '@mui/material';
import { Box, Container, ScopedCssBaseline } from '@mui/material';
import { styled } from '@mui/material/styles';
import { PropsWithChildren, RefObject, useLayoutEffect, useRef } from 'react';
import { useLocation } from 'react-router-dom';
Expand Down Expand Up @@ -34,15 +34,25 @@ const ScrollableContainer = styled(Box)({
display: 'flex',
});

const FlexContainer = styled(Container)({
display: 'flex',
flexBasis: 'auto',
flexDirection: 'column',
flexShrink: 0,
flexGrow: 1,
});

export const AppContainer: React.FC<PropsWithChildren<{}>> = ({ children }) => {
const ref = useRef<HTMLElement>(null);
const { containerStyle } = useWidgetConfig();
return (
<RelativeContainer sx={containerStyle}>
<ScrollableContainer id={ElementId.ScrollableContainer} ref={ref}>
<CssBaselineContainer enableColorScheme>
{children}
<PoweredBy />
<FlexContainer disableGutters>
{children}
<PoweredBy />
</FlexContainer>
</CssBaselineContainer>
</ScrollableContainer>
<ScrollToLocation elementRef={ref} />
Expand Down

0 comments on commit f045008

Please sign in to comment.