adjustments
This commit is contained in:
parent
9b4ca2dd70
commit
92a16b5a05
2 changed files with 11 additions and 25 deletions
|
@ -1,14 +1,14 @@
|
||||||
import Head from 'next/head'
|
import Head from 'next/head'
|
||||||
import styles from '../styles/Home.module.css'
|
import styles from '../styles/Home.module.css'
|
||||||
import HomeComponent from '../components/post'
|
import HomeComponent from '../components/post'
|
||||||
import { Button, ButtonGroup, Loading, Page } from '@geist-ui/core'
|
import { Loading, Page } from '@geist-ui/core'
|
||||||
import { Sun, Moon } from '@geist-ui/icons'
|
|
||||||
import ShiftBy from '../components/shift-by'
|
|
||||||
import useSignedIn from '../lib/hooks/use-signed-in'
|
import useSignedIn from '../lib/hooks/use-signed-in'
|
||||||
import Link from '../components/Link'
|
import Header from '../components/header'
|
||||||
|
import { ThemeProps } from './_app'
|
||||||
|
|
||||||
|
const Home = ({ theme, changeTheme }: ThemeProps) => {
|
||||||
|
const { isSignedIn, isLoading } = useSignedIn({ redirectIfNotAuthed: true })
|
||||||
|
|
||||||
const Home = ({ theme, changeTheme }: { theme: "light" | "dark", changeTheme: () => void }) => {
|
|
||||||
const { isLoading, isSignedIn } = useSignedIn({ redirectIfNotAuthed: true })
|
|
||||||
return (
|
return (
|
||||||
<Page className={styles.container}>
|
<Page className={styles.container}>
|
||||||
<Head>
|
<Head>
|
||||||
|
@ -17,27 +17,13 @@ const Home = ({ theme, changeTheme }: { theme: "light" | "dark", changeTheme: ()
|
||||||
<link rel="icon" href="/favicon.ico" />
|
<link rel="icon" href="/favicon.ico" />
|
||||||
</Head>
|
</Head>
|
||||||
|
|
||||||
{isSignedIn && <Page.Header height={'40px'} margin={0} paddingBottom={0} paddingTop={"var(--gap)"}>
|
<Page.Header>
|
||||||
<ButtonGroup>
|
<Header theme={theme} changeTheme={changeTheme} />
|
||||||
<Button onClick={() => {
|
</Page.Header>
|
||||||
localStorage.clear();
|
|
||||||
window.location.reload();
|
|
||||||
}}>Sign out</Button>
|
|
||||||
<Button>
|
|
||||||
{/* TODO: Link outside Button, but seems to break ButtonGroup */}
|
|
||||||
<Link href="/mine">
|
|
||||||
Your Posts
|
|
||||||
</Link>
|
|
||||||
</Button>
|
|
||||||
<Button onClick={() => changeTheme()}>
|
|
||||||
<ShiftBy y={6}>{theme === 'light' ? <Moon /> : <Sun />}</ShiftBy>
|
|
||||||
</Button>
|
|
||||||
</ButtonGroup>
|
|
||||||
</Page.Header>}
|
|
||||||
|
|
||||||
<Page.Content width={"var(--main-content-width)"} margin="0 auto" className={styles.main}>
|
<Page.Content width={"var(--main-content-width)"} margin="0 auto" className={styles.main}>
|
||||||
{isLoading && <Loading />}
|
{isLoading && <Loading />}
|
||||||
{!isLoading && isSignedIn && <HomeComponent />}
|
{isSignedIn && <HomeComponent />}
|
||||||
</Page.Content>
|
</Page.Content>
|
||||||
</Page >
|
</Page >
|
||||||
)
|
)
|
||||||
|
|
|
@ -19,7 +19,7 @@ const Post = ({ post, theme, changeTheme }: Props) => {
|
||||||
<Page.Header>
|
<Page.Header>
|
||||||
<Header theme={theme} changeTheme={changeTheme} />
|
<Header theme={theme} changeTheme={changeTheme} />
|
||||||
</Page.Header>
|
</Page.Header>
|
||||||
<Page.Content width={"var(--main-content-width)"} margin="0 auto">
|
<Page.Content width={"var(--main-content-width)"} margin="auto">
|
||||||
<Text h2>{post.title} <VisibilityBadge visibility={post.visibility} /></Text>
|
<Text h2>{post.title} <VisibilityBadge visibility={post.visibility} /></Text>
|
||||||
{
|
{
|
||||||
post.files.map(({ id, content, title }: { id: any, content: string, title: string }) => (
|
post.files.map(({ id, content, title }: { id: any, content: string, title: string }) => (
|
||||||
|
|
Loading…
Reference in a new issue