import Head from "next/head"; import Script from "next/script"; import { useTheme } from "next-themes"; import classNames from "classnames"; import Header from "../Header/Header"; import Footer from "../Footer/Footer"; import themes, { toCSS } from "../../lib/themes"; import styles from "./Layout.module.css"; type LayoutProps = JSX.IntrinsicElements["div"] & { noContainer?: boolean; // pass true to disable default `
` container styles with padding, etc. }; const Layout = ({ noContainer, className, children, ...rest }: LayoutProps) => { const { resolvedTheme } = useTheme(); return ( <> {/* convert themes object into inlined css variables */} {/* dynamically set browser theme color to match the background color */} {/* remove the `.no-fade` class above from body once the page is finished loading */}
{/* passing `noContainer={true}` to Layout allows 100% control of the content area on a per-page basis */} {noContainer ? ( <>{children} ) : (
{children}
)}
); }; export default Layout;