import ButtonGrid from "components/ButtonGrid";
import Lanyard from "components/Lanyard";
import Navbar from "components/Navbar";
import getProfiles from "utils/shared/profiles";
import getProjects from "utils/shared/projects";
import { getAllPostIDs, getPostData, getSortedPosts } from "utils/shared/posts";
import { SocialButton } from "utils/types";
import styles from "styles/Index.module.sass";
// import Link from "components/Link";
// import Post from "components/Post";
// import PostGrid from "components/PostGrid";
import Copyright from "components/copyright";
import RenderWithoutJS from "components/RenderWithoutJS";

export async function getStaticProps() {
  const profiles = await getProfiles();
  const posts = await getSortedPosts();
  const projects = await getProjects("showcase-lio")
  return {
    props: {
      profiles,
      posts,
      projects
    },
  };
}

const IndexPage = (props: { profiles: SocialButton[]; posts: Array<any>; projects: SocialButton[] }) => {
  const showposts = false

  let Index = (
    <>
      <div className={styles.center}>
        <Navbar />
        <div>
          <p>Profiles</p>
          <ButtonGrid Buttons={props.profiles} />
        </div>
        <div>
          <p>Projects</p>
          <ButtonGrid Buttons={props.projects} />
        </div>
        {/* {showposts && (<div><p>Posts</p><PostGrid posts={props.posts} /></div>)} */}
      </div>
      <Lanyard />
      <Copyright />
    </>
  );
  return <RenderWithoutJS profiles={props.profiles} children={Index} />
};

export default IndexPage