File tree 2 files changed +37
-4
lines changed
2 files changed +37
-4
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ export default (Page) => {
12
12
// HOC runs before each page and determins if a user is logged in or not
13
13
// Then dispatch result to redux
14
14
const loggedUser = process . browser ? getUserFromLocalStorage ( ) : getUserFromCookie ( ctx . req )
15
+
15
16
ctx . store . dispatch ( validateUserToken ( loggedUser ) )
16
17
const state = ctx . store . getState ( )
17
18
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import { getTodos } from '../actions/todoActions'
5
5
import withRedux from 'next-redux-wrapper'
6
6
import TodoList from '../components/todo/todoList'
7
7
import defaultPage from '../hocs/defaultPage'
8
- import styled from 'styled-components'
8
+ import styled , { css } from 'styled-components'
9
9
import TodoInput from '../components/todo/todoInput'
10
10
import { injectGlobal } from 'styled-components' ;
11
11
@@ -27,6 +27,37 @@ import { injectGlobal } from 'styled-components';
27
27
// }
28
28
// `
29
29
30
+
31
+ const sizes = {
32
+ phone : 378 ,
33
+ tablet : 768 ,
34
+ desktop : 992 ,
35
+ giant : 1170
36
+ }
37
+
38
+ const media = Object . keys ( sizes ) . reduce ( ( finalMedia , size ) => {
39
+
40
+ return {
41
+ ...finalMedia ,
42
+ [ size ] : function ( ...args ) {
43
+ return css `
44
+ @media(max-width: ${ sizes [ size ] } px) {
45
+ ${ css ( ...args ) }
46
+ }
47
+ `
48
+ }
49
+ }
50
+
51
+ } , { } )
52
+
53
+ console . log ( media )
54
+
55
+ const Div = styled . div `
56
+ padding-left: 20px;
57
+ ${ media . tablet `
58
+ padding-left: 30px;
59
+ ` }
60
+ `
30
61
const Title = styled . h1 `${ {
31
62
color : 'red' ,
32
63
fontSize : '50px' ,
@@ -58,10 +89,9 @@ class Counterfirst extends React.Component {
58
89
59
90
return (
60
91
< div >
61
- < Title > Boilerplate App</ Title >
92
+ < Div > < Title > Boilerplate App</ Title > </ Div >
62
93
< p > Production Live Example</ p >
63
- { /*{showTodoInput()}*/ }
64
- < TodoInput />
94
+ { showTodoInput ( ) }
65
95
< TodoList />
66
96
</ div >
67
97
)
@@ -75,3 +105,5 @@ const mapDispatchToProps = (dispatch) => {
75
105
}
76
106
77
107
export default withRedux ( initStore , null , mapDispatchToProps ) ( defaultPage ( Counterfirst ) )
108
+
109
+
You can’t perform that action at this time.
0 commit comments