Skip to content

Commit 360fc1d

Browse files
committed
add dummy data
1 parent b793030 commit 360fc1d

File tree

6 files changed

+62
-17
lines changed

6 files changed

+62
-17
lines changed

components/layout/MainNavigation.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ import classes from "./MainNavigation.module.css";
55
function MainNavigation() {
66
return (
77
<header className={classes.header}>
8-
<div className={classes.logo}>Meetups</div>
8+
<div className={classes.logo}>
9+
<Link href="/">Meetups</Link>
10+
</div>
911
<nav>
1012
<ul>
1113
<li>

components/layout/MainNavigation.module.css

+6-5
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
padding: 0 10%;
99
}
1010

11-
.logo {
11+
.logo a {
1212
font-size: 2rem;
1313
color: white;
1414
font-weight: bold;
15+
text-decoration: none;
1516
}
1617

1718
.header ul {
@@ -26,14 +27,14 @@
2627
margin-left: 3rem;
2728
}
2829

29-
.header a {
30+
.header li a {
3031
text-decoration: none;
3132
font-size: 1.5rem;
3233
color: #fcb8d2;
3334
}
3435

35-
.header a:hover,
36-
.header a:active,
37-
.header a.active {
36+
.header li a:hover,
37+
.header li a:active,
38+
.header li a.active {
3839
color: white;
3940
}

pages/[meetupId]/index.js

+28-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,37 @@
11
import MeetupDetail from "../../components/meetups/MeetupDetail";
22

3-
function MeetupDetailsPage() {
3+
function MeetupDetailsPage(props) {
44
return (
55
<MeetupDetail
6-
title="A First Meetup"
7-
address="85 S. Edgemont Street, Crawfordsville, IN 47933"
8-
description="This is a first meetup!"
9-
image="https://images.unsplash.com/photo-1611095790444-1dfa35e37b52?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=751&q=80"
6+
title={props.meetupData.title}
7+
address={props.meetupData.address}
8+
description={props.meetupData.description}
9+
image={props.meetupData.image}
1010
/>
1111
);
1212
}
1313

14+
export async function getStaticProps(context) {
15+
const meetupId = context.params.meetupId;
16+
return {
17+
props: {
18+
meetupData: {
19+
id: meetupId,
20+
title: "A First Meetup",
21+
address: "85 S. Edgemont Street, Crawfordsville, IN 47933",
22+
description: "This is a first meetup!",
23+
image: "/images/m1.jpg",
24+
},
25+
},
26+
revalidate: 3600,
27+
};
28+
}
29+
30+
export async function getStaticPaths() {
31+
return {
32+
paths: [{ params: { meetupId: "m1" } }, { params: { meetupId: "m2" } }],
33+
fallback: false,
34+
};
35+
}
36+
1437
export default MeetupDetailsPage;

pages/index.js

+25-6
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,42 @@ const DUMMY_MEETUPS = [
44
{
55
id: "m1",
66
title: "A First Meetup",
7-
image:
8-
"https://images.unsplash.com/photo-1611095790444-1dfa35e37b52?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=751&q=80",
7+
image: "/images/m1.jpg",
98
address: "85 S. Edgemont Street, Crawfordsville, IN 47933",
109
description: "This is a first meetup!",
1110
},
1211
{
1312
id: "m2",
1413
title: "A Second Meetup",
15-
image:
16-
"https://images.unsplash.com/photo-1611095973015-2c65f77541e1?ixid=MXwxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=751&q=80",
14+
image: "/images/m2.jpg",
1715
address: "7718 Ann Court, Greensburg, PA 15601",
1816
description: "This is a second meetup!",
1917
},
2018
];
2119

22-
function HomePage() {
23-
return <MeetupList meetups={DUMMY_MEETUPS} />;
20+
function HomePage(props) {
21+
return <MeetupList meetups={props.meetups} />;
22+
}
23+
24+
// On every request
25+
// export async function getServerSideProps(context) {
26+
// const req = context.req;
27+
// const res = context.res;
28+
// return {
29+
// props: {
30+
// meetups: DUMMY_MEETUPS,
31+
// },
32+
// };
33+
// }
34+
35+
// During build process
36+
export async function getStaticProps() {
37+
return {
38+
props: {
39+
meetups: DUMMY_MEETUPS,
40+
},
41+
// revalidate: 3600,
42+
};
2443
}
2544

2645
export default HomePage;

public/images/m1.jpg

62.3 KB
Loading

public/images/m2.jpg

72.7 KB
Loading

0 commit comments

Comments
 (0)