XeNote/pages/index.js

33 lines
944 B
JavaScript
Raw Normal View History

2022-03-31 08:12:00 +00:00
import Layout from "../components/layout";
import {getSinglePost, getDirectoryData, convertObject, getFlattenArray} from "../lib/utils";
import FolderTree from "../components/FolderTree";
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 (
<Layout>
<div className = 'container'>
<nav className="nav-bar">
<FolderTree tree={tree} flattenNodes={flattenNodes}/>
</nav>
<MDContainer post={content.data}/>
</div>
2020-11-28 15:45:01 +00:00
</Layout>
);
}
export function getStaticProps() {
const tree = convertObject(getDirectoryData());
2020-12-01 03:28:42 +00:00
const contentData = getSinglePost("index");
const flattenNodes = getFlattenArray(tree)
2020-11-28 15:45:01 +00:00
return {
props: {
content: contentData,
tree: tree,
flattenNodes: flattenNodes
2020-11-28 15:45:01 +00:00
},
};
}