2022-03-31 08:12:00 +00:00
|
|
|
import Layout from "../components/layout";
|
|
|
|
import {getSinglePost, getDirectoryData, convertObject, getFlattenArray} from "../lib/utils";
|
2022-03-23 15:25:39 +00:00
|
|
|
import FolderTree from "../components/FolderTree";
|
2022-03-31 09:59:10 +00:00
|
|
|
import MDContainer from "../components/MDContainer";
|
2020-12-01 03:28:42 +00:00
|
|
|
|
2022-03-31 08:12:00 +00:00
|
|
|
export default function Home({content, tree, flattenNodes}) {
|
2020-12-01 03:28:42 +00:00
|
|
|
|
2020-11-28 15:45:01 +00:00
|
|
|
return (
|
2022-03-31 08:46:10 +00:00
|
|
|
<Layout>
|
2022-03-24 07:43:18 +00:00
|
|
|
<div className = 'container'>
|
|
|
|
<nav className="nav-bar">
|
|
|
|
<FolderTree tree={tree} flattenNodes={flattenNodes}/>
|
|
|
|
</nav>
|
2022-03-31 09:59:10 +00:00
|
|
|
<MDContainer post={content.data}/>
|
2022-03-24 07:43:18 +00:00
|
|
|
</div>
|
2020-11-28 15:45:01 +00:00
|
|
|
</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");
|
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,
|
2022-03-24 04:15:43 +00:00
|
|
|
tree: tree,
|
|
|
|
flattenNodes: flattenNodes
|
2020-11-28 15:45:01 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|