Skip to content

Commit 0d1b41f

Browse files
committed
heroku repush
1 parent 2da266e commit 0d1b41f

File tree

2 files changed

+37
-4
lines changed

2 files changed

+37
-4
lines changed

hocs/defaultPage.js

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export default (Page) => {
1212
// HOC runs before each page and determins if a user is logged in or not
1313
// Then dispatch result to redux
1414
const loggedUser = process.browser ? getUserFromLocalStorage() : getUserFromCookie(ctx.req)
15+
1516
ctx.store.dispatch(validateUserToken(loggedUser))
1617
const state = ctx.store.getState()
1718

pages/index.js

+36-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { getTodos } from '../actions/todoActions'
55
import withRedux from 'next-redux-wrapper'
66
import TodoList from '../components/todo/todoList'
77
import defaultPage from '../hocs/defaultPage'
8-
import styled from 'styled-components'
8+
import styled, { css } from 'styled-components'
99
import TodoInput from '../components/todo/todoInput'
1010
import { injectGlobal } from 'styled-components';
1111

@@ -27,6 +27,37 @@ import { injectGlobal } from 'styled-components';
2727
// }
2828
// `
2929

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+
`
3061
const Title = styled.h1`${{
3162
color: 'red',
3263
fontSize: '50px',
@@ -58,10 +89,9 @@ class Counterfirst extends React.Component {
5889

5990
return (
6091
<div>
61-
<Title>Boilerplate App</Title>
92+
<Div><Title>Boilerplate App</Title></Div>
6293
<p>Production Live Example</p>
63-
{/*{showTodoInput()}*/}
64-
<TodoInput/>
94+
{showTodoInput()}
6595
<TodoList />
6696
</div>
6797
)
@@ -75,3 +105,5 @@ const mapDispatchToProps = (dispatch) => {
75105
}
76106

77107
export default withRedux(initStore, null, mapDispatchToProps)(defaultPage(Counterfirst))
108+
109+

0 commit comments

Comments
 (0)