Web: Common: Layout: Refactoring

This commit is contained in:
TatianaLopaeva 2020-12-14 16:40:20 +03:00
parent b695e9d081
commit ae5b128285

View File

@ -15,10 +15,10 @@ const StyledContainer = styled.div`
const Layout = (props) => {
const { children } = props;
const isTablet = window.innerWidth <= size.tablet;
const deviceWidth = window.innerWidth <= size.tablet;
const [windowWidth, setWindowWidth] = useState({
matches: isTablet,
const [isTabletWidth, setWindowWidth] = useState({
matches: deviceWidth,
});
useEffect(() => {
@ -86,7 +86,7 @@ const Layout = (props) => {
return (
<StyledContainer className="Layout">
{windowWidth && windowWidth.matches ? (
{isTabletWidth && isTabletWidth.matches ? (
<MobileLayout {...props} />
) : (
children