import BasicPage from "../../../components/basic-page";
import IDCard from "../../../components/identity-card";

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

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

export default function Fursona({ FURSONA }) {
  return (
    <BasicPage page_title={FURSONA["Fursona"].page_title} card_title={FURSONA["Fursona"].card_title}>
    {Object.keys(FURSONA).map((fursona) => (
      <IDCard
        key={fursona}
        title={FURSONA[fursona].title}
        info={FURSONA[fursona].info}
        src={FURSONA[fursona].src}
        alt={FURSONA[fursona].alt}
        src2={FURSONA[fursona].src2}
        alt2={FURSONA[fursona].alt2}
      />
    ))}
    </BasicPage>
  );
}
