From 51967b62cd274b10326a604d4db670e9e89f8fd5 Mon Sep 17 00:00:00 2001 From: flu0r1ne Date: Wed, 21 Jul 2021 02:56:12 -0500 Subject: Automatic generation of list on log page --- pages/logs/index.tsx | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) (limited to 'pages/logs') diff --git a/pages/logs/index.tsx b/pages/logs/index.tsx index 7f11e86..ed3c58b 100644 --- a/pages/logs/index.tsx +++ b/pages/logs/index.tsx @@ -1,16 +1,43 @@ import DefaultPage from '../../templates/Default'; import Markdown from '../../components/Markdown'; + +import { GetStaticProps, GetStaticPropsContext } from 'next'; +import React, { FC } from 'react'; +import { getPosts, getMetadata, Post, PostMetadata } from '../../utils/Posts'; //@ts-ignore import md from './logs.md'; -export default function Logs() { + +interface Props { + posts: Post[] +}; + +const Logs : FC = ({ posts }) => { + console.log(posts); return( - +
    + { + posts.map(({ directory, meta }) => ( +
  • {meta.name}
  • + )) + } +
); -} \ No newline at end of file +}; + +export default Logs; + + +export const getStaticProps: GetStaticProps = async ( + context: GetStaticPropsContext +) => { + const posts = await getPosts(); + + return { + props: { posts: posts }, + } +} -- cgit v1.2.3