Skip to content

Commit ee02fa3

Browse files
committed
updated env variables
1 parent b1c2aa3 commit ee02fa3

File tree

7 files changed

+34
-12
lines changed

7 files changed

+34
-12
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.next/
22
node_modules/
3-
env-config.js
3+
config.json
4+
.env

components/Page.js

+12-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
import { connect } from 'react-redux'
22
import Header from './Header'
3+
import styled from 'styled-components'
34

4-
export default connect(state => state)(({ title, linkTo, lastUpdate, light, url }) => {
5+
const Other = styled.h2`${{
6+
color: 'green',
7+
fontSize: '40px',
8+
fontFamily: 'Open Sans',
9+
'> a': {
10+
fontSize: '18px'
11+
}
12+
}}`
13+
export default connect(state => state)(({ title, linkTo, lastUpdate, light}) => {
514
return (
615
<div>
7-
<Header url={url} />
8-
<h1>{title}</h1>
16+
<Other>{title}</Other>
17+
<p>Simple Page template</p>
918
<div>
1019
<p><a href='http://redux.js.org/docs/basics/Reducers.html'>Reducers</a> are at the heart of Redux, and they give us a clean and predictable way to change the state of our application. When using Reducers, we need to make sure that no data gets mutated. This gives us the benefit of being able to inspect every previous state of the data in our app, and it’s an important concept in Redux.</p>
1120
</div>

pages/_document.js

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class MyDocument extends Document {
1212
return (
1313
<html>
1414
<Head>
15+
<link async href='//fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'></link>
1516
<title>My page</title>
1617
{styleTags}
1718
</Head>

pages/index.js

+8
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ import TodoList from '../components/todo/todoList'
77
import defaultPage from '../hocs/defaultPage'
88
import styled from 'styled-components'
99
import TodoInput from '../components/todo/todoInput'
10+
import { injectGlobal } from 'styled-components';
11+
12+
injectGlobal`
13+
body {
14+
margin: 0;
15+
}
16+
`;
1017

1118
// const rule1 = {
1219
// backgroundColor: 'blue',
@@ -28,6 +35,7 @@ import TodoInput from '../components/todo/todoInput'
2835
const Title = styled.h1`${{
2936
color: 'red',
3037
fontSize: '50px',
38+
fontFamily: 'Open Sans',
3139
'> a': {
3240
fontSize: '18px'
3341
}

pages/other.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from 'react'
22
import { initStore } from '../store'
33
import withRedux from 'next-redux-wrapper'
4+
import defaultPage from '../hocs/defaultPage'
45
import Page from '../components/Page'
56

67
class Counter extends React.Component {
@@ -19,4 +20,4 @@ class Counter extends React.Component {
1920
}
2021
}
2122

22-
export default withRedux(initStore)(Counter)
23+
export default withRedux(initStore)(defaultPage(Counter))

store.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { createStore, applyMiddleware, combineReducers } from 'redux'
22
import thunkMiddleware from 'redux-thunk'
3+
import { composeWithDevTools } from 'redux-devtools-extension'
34
import { todosReducer } from './reducers/todosReducer'
45
import { authReducer } from './reducers/authReducer'
56
import { jokesReducer } from './reducers/jokesReducer'
@@ -15,12 +16,10 @@ export const initStore = (initialState = {}) => {
1516
form: formReducer
1617
})
1718

19+
1820
let env = process.env.NODE_ENV || 'development'
1921

2022
if (typeof window !== 'undefined' && env === 'development' ) {
21-
22-
const composeWithDevTools = require('redux-devtools-extension')
23-
2423
// const composeEnhancers = composeWithDevTools({
2524
// // Specify here name, actionsBlacklist, actionsCreators and other options if needed
2625
// actionsBlacklist: ['TICK']

utils/lock.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
/* global AUTH0_CLIENT_ID */
2-
/* global AUTH0_CLIENT_DOMAIN */
1+
let env = process.env.NODE_ENV || 'development'
32

43
const getLock = (options) => {
54
const config = require('../config.json')
65
const Auth0Lock = require('auth0-lock').default
7-
return new Auth0Lock(config.AUTH0_CLIENT_ID, config.AUTH0_CLIENT_DOMAIN, options)
8-
// return new Auth0Lock(AUTH0_CLIENT_ID, AUTH0_CLIENT_DOMAIN, options)
6+
7+
if(env === 'development' || env === 'test'){
8+
return new Auth0Lock(config.AUTH0_CLIENT_ID, config.AUTH0_CLIENT_DOMAIN, options)
9+
}
10+
11+
return new Auth0Lock(process.env.AUTH0_CLIENT_ID, process.env.AUTH0_CLIENT_DOMAIN, options)
912
}
1013

1114
const getBaseUrl = () => `${window.location.protocol}//${window.location.host}`

0 commit comments

Comments
 (0)