File tree Expand file tree Collapse file tree 5 files changed +68
-8
lines changed Expand file tree Collapse file tree 5 files changed +68
-8
lines changed Original file line number Diff line number Diff line change
1
+ { "presets" : [" next/babel" ], "plugins" : [[" styled-components" , { "ssr" : true }]] }
Original file line number Diff line number Diff line change
1
+ import React from 'react' ;
2
+ import PropTypes from 'prop-types' ;
3
+ import Link from 'next/link' ;
4
+ import styled from 'styled-components' ;
5
+
6
+ const CityDiv = styled . div `
7
+ display: flex;
8
+ flex-direction: column;
9
+ justify-content: center;
10
+ align-items: center;
11
+ background-color: #ff686b;
12
+ border: 1px solid #e6e6e6;
13
+ border-radius: 3px;
14
+ box-shadow: 0 4px 4px rgba(0,0,0,0.5);
15
+ padding: 30px;
16
+ cursor: pointer;
17
+ transition: filter 0.2s ease-in-out;
18
+
19
+ &:hover {
20
+ filter: brightness(1.2);
21
+ }
22
+
23
+ &:active {
24
+ filter: brightness(0.8);
25
+ }
26
+ ` ;
27
+
28
+ export default class Cities extends React . Component {
29
+ static propTypes = {
30
+ href : PropTypes . string . isRequired ,
31
+ city_event : PropTypes . object . isRequired ,
32
+ }
33
+
34
+ constructor ( props ) {
35
+ super ( props ) ;
36
+ }
37
+
38
+ render ( ) {
39
+ const { href, city_event } = this . props ;
40
+
41
+ return (
42
+ < CityDiv onClick = { ( ) => { window . location = href } } >
43
+ < h3 > { city_event . name } </ h3 >
44
+ </ CityDiv >
45
+ ) ;
46
+ }
47
+ }
Original file line number Diff line number Diff line change @@ -11,5 +11,8 @@ module.exports = {
11
11
12
12
return config ;
13
13
} ,
14
+ compiler : {
15
+ styledComponents : true
16
+ } ,
14
17
port : 8001 ,
15
18
} ;
Original file line number Diff line number Diff line change 3
3
"version" : " 0.1.0" ,
4
4
"private" : true ,
5
5
"scripts" : {
6
- "dev" : " next dev" ,
7
- "build" : " next build" ,
6
+ "dev" : " NODE_OPTIONS=--openssl-legacy-provider next dev" ,
7
+ "build" : " NODE_OPTIONS=--openssl-legacy-provider next build" ,
8
8
"start" : " NODE_ENV=production node server.js"
9
9
},
10
10
"dependencies" : {
Original file line number Diff line number Diff line change @@ -2,6 +2,17 @@ import React from 'react';
2
2
import PropTypes from 'prop-types' ;
3
3
import Link from 'next/link' ;
4
4
import Srnd from '../server/srndApi' ;
5
+ import Cities from '../components/cities' ;
6
+ import styled from 'styled-components' ;
7
+
8
+ const CityContainer = styled . div `
9
+ display: flex;
10
+ flex-direction: row;
11
+ flex-wrap: wrap;
12
+ justify-content: center;
13
+ align-items: center;
14
+ gap: 10px;
15
+ ` ;
5
16
6
17
export default class Index extends React . Component {
7
18
static propTypes = {
@@ -21,13 +32,11 @@ export default class Index extends React.Component {
21
32
< div >
22
33
< h1 > CodeDay Present</ h1 >
23
34
< p > Pick a city...</ p >
24
- < ul >
25
- { events . map ( ( event ) => (
26
- < li >
27
- < Link href = { `/e/${ event . id } ` } > { event . name } </ Link >
28
- </ li >
35
+ < CityContainer >
36
+ { events . map ( ( event , index ) => (
37
+ < Cities key = { index } href = { `/e/${ event . id } ` } city_event = { event } />
29
38
) ) }
30
- </ ul >
39
+ </ CityContainer >
31
40
</ div >
32
41
) ;
33
42
}
You can’t perform that action at this time.
0 commit comments