diff options
Diffstat (limited to 'pages/index.tsx')
-rw-r--r-- | pages/index.tsx | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/pages/index.tsx b/pages/index.tsx index 96b8684..65b53cb 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -1,52 +1,52 @@ -import Navbar, { NavbarItem } from '../components/navbar'; import Chapters, { chapter } from '../components/chapters'; +import Navbar, { NavbarItem } from '../components/navbar'; import Seperator from '../components/seperator'; -import { getStaticProps as getBlogPage, ArticleMeta, RenderedArticle } from './post/[id]'; +import { ArticleMeta, getStaticProps as getBlogPage, RenderedArticle } from './post/[id]'; -var posts = ["index", "index", "index"]; +var posts = ['index', 'index', 'index']; export default function Home(props: { posts: Array<{ props: { - content: string, - meta: ArticleMeta - } - }> + content: string; + meta: ArticleMeta; + }; + }>; }) { return <div> - <div className="centeredPage"> - <div className="titleWrapper"> + <div className='centeredPage'> + <div className='titleWrapper'> <h1>{props.posts[0].props.meta.title}</h1> </div> - <div className="navAreaWrapper"> - <div className="sticky"> - <Navbar page="home"/> - <NavbarItem title="Pinned posts:" classList={["pinned"]}/> - <Chapters chapters={[ - ...props.posts.slice(1).map(post => { - return { - children: post.props.meta.chapters, - name: post.props.meta.title, - sectionLink: "/post/" + post.props.meta.id - } as chapter - }) - ]}/> + <div className='navAreaWrapper'> + <div className='sticky'> + <Navbar page='home' /> + <NavbarItem title='Pinned posts:' classList={['pinned']} /> + <Chapters + chapters={[ + ...props.posts.slice(1).map(post => { + return { + children: post.props.meta.chapters, + name: post.props.meta.title, + sectionLink: '/post/' + post.props.meta.id, + } as chapter; + }), + ]} + /> </div> </div> - <div className="contentWrapper"> - { - props.posts.map((post, index) => { - return <> - { index != 0 && <h1>{post.props.meta.title}</h1> } - <RenderedArticle content={post.props.content}/> - { index + 1 != props.posts.length && <Seperator/> } - </> - }) - } + <div className='contentWrapper'> + {props.posts.map((post, index) => { + return <> + {index != 0 && <h1>{post.props.meta.title}</h1>} + <RenderedArticle content={post.props.content} /> + {index + 1 != props.posts.length && <Seperator />} + </>; + })} </div> </div> - </div> + </div>; } export function getStaticProps() { @@ -54,9 +54,9 @@ export function getStaticProps() { posts.forEach(id => { postsContent.push(getBlogPage({ params: { id } })); - }) + }); var staticProps = { props: { posts: postsContent } }; - - return staticProps + + return staticProps; } |