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';


interface Props {
  posts: Post[]
};

const Logs : FC<Props> = ({ posts }) => {
  console.log(posts);
  return(
    <DefaultPage
      path={"/logs"}
    >
      <ul>
      {
        posts.map(({ directory, meta }) => (
          <li><a href={'/logs/' + directory}>{meta.name}</a></li>
        ))
      }
      </ul>
    </DefaultPage>
  );
};

export default Logs;


export const getStaticProps: GetStaticProps = async (
  context: GetStaticPropsContext
) => {
  const posts = await getPosts();

  return {
    props: { posts: posts },
  }
}
