aboutsummaryrefslogtreecommitdiff
path: root/pages/logs/index.tsx
blob: af227e93be0c73c93a76b06fa1ddebf668c5bbf5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import DefaultPage from '../../templates/Default';
import Markdown from '../../components/Markdown';
import styles from './index.module.scss';

import { GetStaticProps, GetStaticPropsContext } from 'next';
import React, { FC } from 'react';
import { getPosts, Post } from '../../utils/Posts';

import Link from '../../components/Link';
import { List, ListItem } from '../../components/List';

// @ts-ignore
import md from './logs.md';

interface Props {
  posts: Post[]
};

const Logs : FC<Props> = ({ posts }) => {

  return(
    <DefaultPage
      path={"/logs"}
    >
      <>
        <Markdown md={md} />
        <List variant="unordered">
        {
          posts.map(({ directory, meta }) => (
            <ListItem key={directory}><Link href={'/logs/' + directory}>{meta.name}</Link></ListItem>
          ))
        }
        </List>
      </>
    </DefaultPage>
  );
};

export default Logs;


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

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