hierarchical-estimates-visu.../pages/index.js

33 lines
817 B
JavaScript
Raw Normal View History

/* Notes */
// This function is just a simple wrapper around lib/comparisonView.
// Most of the time, I'll want to edit that instead
/* Imports */
import React from "react";
2022-01-30 15:29:45 +00:00
import fs from "fs";
import path from "path";
import ComparisonView from "../lib/comparisonView.js";
/* Definitions */
2022-01-30 15:29:45 +00:00
const elementsDocument = "../data/listOfMoralGoods.json";
2021-06-07 14:01:15 +00:00
/* React components */
2021-06-07 11:16:28 +00:00
export async function getStaticProps() {
2022-01-30 15:29:45 +00:00
const directory = path.join(process.cwd(), "pages");
let listOfElementsForView = JSON.parse(
fs.readFileSync(path.join(directory, elementsDocument), "utf8")
);
2021-06-07 11:16:28 +00:00
return {
props: {
2022-01-30 15:29:45 +00:00
listOfElementsForView,
2021-06-07 11:16:28 +00:00
},
};
}
// Main react component
export default function Home({ listOfElementsForView }) {
2022-01-30 15:29:45 +00:00
return <ComparisonView listOfElementsForView={listOfElementsForView} />;
}