CoastalCommitsPastes/client/pages/new.tsx

36 lines
1.1 KiB
TypeScript
Raw Normal View History

2022-03-06 19:46:59 -05:00
import Head from 'next/head'
import styles from '../styles/Home.module.css'
import HomeComponent from '../components/post'
2022-03-06 20:41:30 -05:00
import { Loading, Page } from '@geist-ui/core'
2022-03-06 19:46:59 -05:00
import useSignedIn from '../lib/hooks/use-signed-in'
2022-03-06 20:41:30 -05:00
import Header from '../components/header'
import { ThemeProps } from './_app'
2022-03-06 22:20:38 -05:00
import { useRouter } from 'next/router'
2022-03-06 20:41:30 -05:00
const Home = ({ theme, changeTheme }: ThemeProps) => {
2022-03-06 22:20:38 -05:00
const router = useRouter()
2022-03-06 20:41:30 -05:00
const { isSignedIn, isLoading } = useSignedIn({ redirectIfNotAuthed: true })
2022-03-06 22:20:38 -05:00
if (!isSignedIn && !isLoading) {
router.push("/signin")
}
2022-03-06 19:46:59 -05:00
return (
2022-03-07 21:36:36 -05:00
<Page className={styles.container} width="100%">
2022-03-06 19:46:59 -05:00
<Head>
<title>Drift</title>
<meta name="description" content="A self-hostable clone of GitHub Gist" />
<link rel="icon" href="/favicon.ico" />
</Head>
2022-03-06 20:41:30 -05:00
<Page.Header>
<Header theme={theme} changeTheme={changeTheme} />
</Page.Header>
2022-03-06 19:46:59 -05:00
<Page.Content width={"var(--main-content-width)"} margin="0 auto" className={styles.main}>
2022-03-06 20:41:30 -05:00
{isSignedIn && <HomeComponent />}
2022-03-06 19:46:59 -05:00
</Page.Content>
</Page >
)
}
export default Home