utility-function-extractor/packages/webpage-refactor/pages/index.js

32 lines
792 B
JavaScript
Raw Permalink Normal View History

2022-06-17 17:44:08 +00:00
/* Notes */
2022-06-20 00:50:53 +00:00
// This function is just a simple wrapper around components/homepage.
2022-06-17 17:44:08 +00:00
// Most of the time, I'll want to edit that instead
/* Imports */
import React from "react";
import fs from "fs";
import path from "path";
import { Homepage } from "../components/homepage.js";
/* Definitions */
2022-06-18 18:18:15 +00:00
const elementsDocument = "../data/listOfObjects.json";
2022-06-17 17:44:08 +00:00
/* React components */
export async function getStaticProps() {
const directory = path.join(process.cwd(), "pages");
let listOfElementsInit = JSON.parse(
fs.readFileSync(path.join(directory, elementsDocument), "utf8")
);
return {
props: {
listOfElementsInit,
},
};
}
// Main react component
export default function Home({ listOfElementsInit }) {
return <Homepage listOfElementsInit={listOfElementsInit} />;
}