Add posts and old grade-calc
Fix small bugs >bad commit
This commit is contained in:
+27
-10
@@ -2,29 +2,46 @@ import Link from 'next/link';
|
||||
import React from 'react';
|
||||
import Layout from '../components/layout';
|
||||
import Pages from '../public/pages.json';
|
||||
import cachePostLinkData from '../util/post-cache';
|
||||
|
||||
// import { GetStaticProps } from 'next';
|
||||
|
||||
function HomePage() {
|
||||
function HomePage({posts}: any) {
|
||||
Pages.sort((x, y) => { return ('' + x.title).localeCompare(y.title) });
|
||||
return (
|
||||
<Layout name='' title='PaulW.XYZ'>
|
||||
<section className='block' style={{ textAlign: 'center' }}>
|
||||
<div className='h2'>Welcome to my website!</div> {
|
||||
<section className='block'>
|
||||
<div className='h2'>Welcome!</div>
|
||||
{
|
||||
Pages.map(obj => {
|
||||
return <div key='' className='h3'>
|
||||
return <div key='' className='h5'>
|
||||
<Link href={obj.link}>
|
||||
<a>{obj.title}</a>
|
||||
<a>{obj.title}{obj.link.match('^http*')? ' ↗' : ''}</a>
|
||||
</Link>
|
||||
</div>
|
||||
})
|
||||
}
|
||||
</section>
|
||||
<section className='block'>
|
||||
<div className='h2'>Posts</div>
|
||||
<div>
|
||||
{posts?.map((post: any) => {
|
||||
return <div key={post.slug} className='h5'>
|
||||
[{ (new Date(post.last_updated)).toLocaleString()}] <Link href={`posts/${post.slug}`}>
|
||||
{post.title}
|
||||
</Link>
|
||||
</div>
|
||||
})}
|
||||
</div>
|
||||
</section>
|
||||
</Layout>
|
||||
)
|
||||
}
|
||||
|
||||
export default HomePage;
|
||||
export async function getStaticProps() {
|
||||
// make this webpack plugin
|
||||
return {
|
||||
props: {posts: cachePostLinkData()}
|
||||
};
|
||||
}
|
||||
|
||||
// export async function getStaticProps(context): GetStaticProps {
|
||||
|
||||
// }
|
||||
export default HomePage;
|
||||
Reference in New Issue
Block a user