XeNote/pages/index.js

37 lines
1.1 KiB
JavaScript
Raw Normal View History

import Layout, {siteTitle} from "../components/layout";
2022-03-24 04:55:12 +00:00
import {getSinglePost, getGraphData, getDirectoryData, convertObject, getFlattenArray} from "../lib/utils";
import FolderTree from "../components/FolderTree";
import {Box} from '@mui/material'
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>
<div className = 'container'>
<nav className="nav-bar">
<FolderTree tree={tree} flattenNodes={flattenNodes}/>
</nav>
<main className="markdown-rendered">
<div dangerouslySetInnerHTML={{__html: content.data}}/>
</main>
</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");
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
},
};
}