CoastalCommitsPastes/client/app/layout.tsx

32 lines
812 B
TypeScript
Raw Normal View History

2022-11-09 21:38:05 -05:00
import "@styles/globals.css"
2022-11-09 01:14:43 -05:00
import { ServerThemeProvider } from "next-themes"
2022-11-09 21:38:05 -05:00
import { LayoutWrapper } from "./root-layout-wrapper"
import styles from '@styles/Home.module.css';
2022-11-12 21:39:03 -05:00
import { cookies } from "next/headers";
2022-11-09 01:14:43 -05:00
interface RootLayoutProps {
children: React.ReactNode
}
export default async function RootLayout({ children }: RootLayoutProps) {
// TODO: this opts out of SSG
2022-11-12 21:39:03 -05:00
const cookiesList = cookies();
const hasNextAuth = cookiesList.get("next-auth.session-token") !== undefined;
2022-11-09 01:14:43 -05:00
return (
<ServerThemeProvider
disableTransitionOnChange
2022-11-09 21:38:05 -05:00
attribute="data-theme"
2022-11-11 19:33:43 -05:00
enableColorScheme
2022-11-09 01:14:43 -05:00
>
<html lang="en">
<head>
2022-11-09 01:14:43 -05:00
</head>
<body className={styles.main}>
2022-11-12 21:39:03 -05:00
<LayoutWrapper signedIn={hasNextAuth}>{children}</LayoutWrapper>
2022-11-10 02:11:36 -05:00
</body>
2022-11-09 01:14:43 -05:00
</html>
</ServerThemeProvider>
)
}