import BasicPage from "../../../components/basic-page";
import IDCard from "../../../components/identity-card";
import IDCardText from "../../../components/identity-card-textbox";
import IDCardButton from "../../../components/identity-card-button";

export async function getStaticProps() {
  const fs = require("fs");
  const yaml = require("js-yaml");
  let NEURO = "";

  try {
    let fileContent = fs.readFileSync("./data/identities/neuro.yml", "utf8");
    NEURO = yaml.load(fileContent);
  } catch (e) {
    console.log(e);
  }
  return {
    props: {
      NEURO,
    },
  };
}

export default function Neurodiversity({ NEURO }) {
  return (
    <BasicPage
      page_title={NEURO["Neuro"].page_title}
      card_title={NEURO["Neuro"].card_title}
      page_button_title="Take me back home!"
    >
      {Object.keys(NEURO).map((neuro) => (
        <IDCard
          key={neuro}
          title={NEURO[neuro].title}
          src={NEURO[neuro].src}
          alt={NEURO[neuro].alt}
        >
          <IDCardText info={NEURO[neuro].info} />
          <IDCardButton url={NEURO[neuro].url} button_text="Learn More" />
        </IDCard>
      ))}
    </BasicPage>
  );
}
