2021-12-08 03:38:31 +00:00
|
|
|
import React from 'react';
|
2022-10-05 03:41:59 +00:00
|
|
|
import Link from 'next/link';
|
2021-12-08 03:38:31 +00:00
|
|
|
import Layout from '../components/layout';
|
2022-04-28 01:55:18 +00:00
|
|
|
import QuickLinks from '../components/quick-links';
|
2022-04-28 16:37:12 +00:00
|
|
|
import RecentNotes from '../components/recent-notes';
|
2022-04-28 01:55:18 +00:00
|
|
|
import RecentPosts from '../components/recent-posts';
|
2022-10-05 03:41:59 +00:00
|
|
|
import { getNotesMeta, getPostsMeta, INoteMeta, IPostMeta } from '../lib/slug';
|
2021-12-08 03:38:31 +00:00
|
|
|
|
2022-10-05 03:41:59 +00:00
|
|
|
function Nav() {
|
2023-09-20 04:25:34 +00:00
|
|
|
const nav = { 'Posts': '/posts', 'Notes': '/notes', 'About': '/about', };
|
2022-10-05 03:41:59 +00:00
|
|
|
return (
|
2023-09-20 04:25:34 +00:00
|
|
|
<div className='block' style={{ textAlign: 'center' }}>
|
2022-10-05 03:41:59 +00:00
|
|
|
{
|
2022-10-05 03:46:16 +00:00
|
|
|
Object.entries(nav).map(([k, v], i) => {
|
2023-09-20 04:25:34 +00:00
|
|
|
return <Link key={i} href={v} className='button green'>{k}</Link>
|
2022-10-05 03:41:59 +00:00
|
|
|
})
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
function HomePage({ postsMeta, notesMeta }: { postsMeta: IPostMeta[], notesMeta: INoteMeta[] }) {
|
2021-12-08 03:38:31 +00:00
|
|
|
return (
|
|
|
|
<Layout name='' title='PaulW.XYZ'>
|
2022-10-05 03:41:59 +00:00
|
|
|
<Nav />
|
2022-05-15 13:56:45 +00:00
|
|
|
<QuickLinks />
|
|
|
|
<RecentNotes notesMeta={notesMeta} />
|
2022-10-05 03:41:59 +00:00
|
|
|
<RecentPosts postsMeta={postsMeta} />
|
2021-12-08 03:38:31 +00:00
|
|
|
</Layout>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2022-04-27 10:39:10 +00:00
|
|
|
export async function getStaticProps() {
|
2022-04-27 08:03:21 +00:00
|
|
|
return {
|
2022-04-28 16:37:12 +00:00
|
|
|
props: { postsMeta: getPostsMeta(), notesMeta: getNotesMeta() }
|
2022-04-27 08:03:21 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2023-09-20 04:25:34 +00:00
|
|
|
export default HomePage;
|