-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.tsx
69 lines (64 loc) · 2.11 KB
/
index.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import { FunctionComponent } from "react";
import Head from "next/head";
import Link from "next/link";
import Constellation from "./../components/constellation";
import Layout from "../components/layout";
import { siteTitle } from "../config";
import Date from "../components/date";
import { getSortedPostsData, MatterInfo } from "../lib/posts";
import utilStyles from "../styles/utils.module.css";
interface IndexProps {
allPostsData: MatterInfo[];
}
const Home: FunctionComponent<IndexProps> = ({ allPostsData }) => {
return (
<Layout pageId="home">
<Head>
<title>{siteTitle}</title>
</Head>
<Constellation />
<section>
<h2>Data Science @ UCSC</h2>
<hr />
<p>
Data science is an inter-disciplinary field at the intersection of
computer science and statistics that seeks to extract knowledge and
create meaningful insights from data.
</p>
<p>
Data Science @ UCSC brings students together to bridge the gap
between academia and industry through workshops, machine learning
competitions, guest lectures and consulting projects.
</p>
</section>
<section className={`${utilStyles.headingMd} ${utilStyles.padding1px}`}>
<h2 className={utilStyles.headingLg}>Events</h2>
<hr />
<ul className={utilStyles.list}>
{allPostsData
// dont show non-blog pages on the blog
.filter(({ blog }) => blog)
.map(({ id, date, title }) => (
<li className={utilStyles.listItem} key={id}>
<Link href="/posts/[id]" as={`/posts/${id}`}>
<a className={utilStyles.blogLink}>{title}</a>
</Link>
<small className={utilStyles.lightText}>
<Date dateString={date} />
</small>
</li>
))}
</ul>
</section>
</Layout>
);
};
export async function getStaticProps() {
let allPostsData: MatterInfo[] = getSortedPostsData();
return {
props: {
allPostsData,
},
};
}
export default Home;