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

29 lines
802 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";
2021-06-07 11:16:28 +00:00
import fs from 'fs';
import path from 'path';
import ComparisonView from '../lib/comparisonView.js'
/* Definitions */
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() {
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: {
listOfElementsForView
2021-06-07 11:16:28 +00:00
},
};
}
// Main react component
export default function Home({ listOfElementsForView }) {
return(<ComparisonView listOfElementsForView={listOfElementsForView}/>)
}