2022-03-17 08:42:57 +00:00
|
|
|
import Layout, {siteTitle} from "../components/layout";
|
2022-03-24 04:15:43 +00:00
|
|
|
import {getSinglePost, getGraphData, getDirectoryData, convertObject, getFlattenArray} from "../lib/post";
|
2022-03-23 15:25:39 +00:00
|
|
|
import FolderTree from "../components/FolderTree";
|
2020-12-01 03:28:42 +00:00
|
|
|
|
2022-03-24 04:15:43 +00:00
|
|
|
export default function Home({content, graphdata, filenames, tree,flattenNodes, ...props}) {
|
2020-12-01 03:28:42 +00:00
|
|
|
|
2020-11-28 15:45:01 +00:00
|
|
|
return (
|
|
|
|
<Layout home>
|
2020-11-30 11:29:34 +00:00
|
|
|
<section>
|
2022-03-24 04:15:43 +00:00
|
|
|
<FolderTree tree={tree} flattenNodes = {flattenNodes}/>
|
2022-03-17 08:42:57 +00:00
|
|
|
<div dangerouslySetInnerHTML={{__html: content.data}}/>
|
2020-11-28 15:45:01 +00:00
|
|
|
</section>
|
|
|
|
</Layout>
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export function getStaticProps() {
|
2022-03-23 15:25:39 +00:00
|
|
|
const tree = convertObject(getDirectoryData());
|
2020-12-01 03:28:42 +00:00
|
|
|
const contentData = getSinglePost("index");
|
2020-11-30 11:29:34 +00:00
|
|
|
const graphdata = getGraphData();
|
2022-03-24 04:15:43 +00:00
|
|
|
const flattenNodes = getFlattenArray(tree)
|
2020-11-28 15:45:01 +00:00
|
|
|
return {
|
|
|
|
props: {
|
2022-03-17 08:42:57 +00:00
|
|
|
content: contentData,
|
|
|
|
graphdata: graphdata,
|
2022-03-24 04:15:43 +00:00
|
|
|
tree: tree,
|
|
|
|
flattenNodes: flattenNodes
|
2020-11-28 15:45:01 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|