58 lines
1.8 KiB
JavaScript
58 lines
1.8 KiB
JavaScript
import HomePage from "../components/home-page";
|
|
import IDBlock from "../components/identity-block";
|
|
import WCard from "../components/werefox-card";
|
|
import ICard from "../components/introduction-card";
|
|
import PBlock from "../components/page-block";
|
|
|
|
// An object listing pages folks can visit
|
|
export async function getStaticProps() {
|
|
const fs = require("fs");
|
|
const yaml = require("js-yaml");
|
|
let IDENTITIES = {};
|
|
let INTRODUCTION = {};
|
|
let PAGES = {};
|
|
let PARTNERS = {};
|
|
|
|
try {
|
|
let fileContent = fs.readFileSync("./data/identities.yml", "utf8");
|
|
IDENTITIES = yaml.load(fileContent);
|
|
fileContent = fs.readFileSync("./data/introduction.yml", "utf8");
|
|
INTRODUCTION = yaml.load(fileContent);
|
|
fileContent = fs.readFileSync("./data/pages.yml", "utf8");
|
|
PAGES = yaml.load(fileContent);
|
|
fileContent = fs.readFileSync("./data/identities/partners.yml", "utf8");
|
|
PARTNERS = yaml.load(fileContent);
|
|
} catch (e) {
|
|
console.log(e);
|
|
}
|
|
return {
|
|
props: {
|
|
IDENTITIES,
|
|
INTRODUCTION,
|
|
PAGES,
|
|
PARTNERS,
|
|
},
|
|
};
|
|
}
|
|
|
|
export default function Home({ IDENTITIES, INTRODUCTION, PAGES, PARTNERS }) {
|
|
const partnerslen = PARTNERS ? Object.keys(PARTNERS).length : 0;
|
|
let introarray = INTRODUCTION["intro"].split("\n");
|
|
introarray = introarray.slice(0, introarray.length - 1);
|
|
const introdict = Object.assign({}, introarray);
|
|
|
|
return (
|
|
<HomePage page_title="About A Werefox" card_title="Hi! I'm Alexis Werefox!">
|
|
<WCard innerText="Basic Info">
|
|
<IDBlock identities={IDENTITIES} partners={partnerslen} />
|
|
</WCard>
|
|
<WCard innerText="Welcome to my little info site!">
|
|
<ICard introduction={introdict} />
|
|
</WCard>
|
|
<WCard innerText="Neat Pages!">
|
|
<PBlock pages={PAGES} />
|
|
</WCard>
|
|
</HomePage>
|
|
);
|
|
}
|