import PageFooter from './footer';
import PageNavbar from './navbar';
import Script from 'next/script';
import { Page, Main } from './styles/generic';
import useWindowSize from './windowsize';

const Layout = ({ children }: { children: React.ReactNode }) => {
  const isMobile = useWindowSize();

  let ret: JSX.Element;
  if(isMobile) {
    ret = (
      <Page mobile={isMobile}>
        <PageNavbar mobile={isMobile}/>
        <Main>
          {children}
        </Main>
      </Page>
    );
  }
  else {
    ret = (
      <Page>
        <PageNavbar mobile={isMobile}/>
        <Main>
          {children}
        </Main>
        <PageFooter />
      </Page>
    );
  }
  return ret;
}

export default Layout;