Add posts and old grade-calc

Fix small bugs
>bad commit
This commit is contained in:
2022-02-14 15:32:58 -05:00
parent 3e6a540fce
commit a40f30f5ec
21 changed files with 1047 additions and 267 deletions
+27 -10
View File
@@ -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;