frontpage/pages/index.tsx

31 lines
1.0 KiB
TypeScript
Raw Normal View History

2022-09-30 19:23:14 +02:00
import type { NextPage } from "next";
2022-08-08 12:38:52 +02:00
import type { ContentList } from "../lib/content/types";
2022-09-30 19:23:14 +02:00
import ProjectCard from "../components/Blog/Card";
2022-10-08 13:37:28 +02:00
import { getContentList } from "../lib/content/generateBackend";
2022-10-07 23:03:39 +02:00
2022-10-01 14:04:21 +02:00
import styles from "../styles/Blog/Front.module.scss";
2022-10-07 23:36:57 +02:00
import Layout from "../components/Blog/Layout";
2021-11-30 23:48:54 +01:00
2022-10-03 01:20:17 +02:00
const Blog: NextPage<{ content: ContentList }> = ({content}) => {
2022-09-30 19:38:25 +02:00
const generateCards = (type: string) => {
2022-10-07 23:03:39 +02:00
return <div className={styles.contentList}>{content.filter(p => p.type === type).map(p => <ProjectCard key={p.name} title={p.title} description={p.desc.join(" ")} type={p.type} name={p.name} />)}</div>;
2022-09-30 19:38:25 +02:00
};
2022-09-30 19:23:14 +02:00
return <>
2022-10-07 23:36:57 +02:00
<Layout>
<h1>Hello there!</h1>
<p>Miaumiau Lorem ipsum</p>
<h2>Projects</h2>
{ generateCards("project") }
<h2>Diaries</h2>
{ generateCards("diary") }
</Layout>
2022-09-30 19:23:14 +02:00
</>;
2022-06-14 19:07:21 +02:00
};
2022-10-03 01:20:17 +02:00
export async function getServerSideProps() {
2022-10-08 13:37:28 +02:00
return { props: { content: await getContentList() } };
2022-10-03 01:20:17 +02:00
}
2022-09-30 19:23:14 +02:00
export default Blog;