XeNote/pages/index.js

32 lines
963 B
JavaScript
Raw Normal View History

import Layout, {siteTitle} from "../components/layout";
import {getSinglePost, getGraphData, getDirectoryData, convertObject, getFlattenArray} from "../lib/post";
import FolderTree from "../components/FolderTree";
2020-12-01 03:28:42 +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>
<FolderTree tree={tree} flattenNodes = {flattenNodes}/>
<div dangerouslySetInnerHTML={{__html: content.data}}/>
2020-11-28 15:45:01 +00:00
</section>
</Layout>
);
}
export function getStaticProps() {
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();
const flattenNodes = getFlattenArray(tree)
2020-11-28 15:45:01 +00:00
return {
props: {
content: contentData,
graphdata: graphdata,
tree: tree,
flattenNodes: flattenNodes
2020-11-28 15:45:01 +00:00
},
};
}