summaryrefslogtreecommitdiff
path: root/src/main/js
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/js')
-rw-r--r--src/main/js/.editorconfig9
-rw-r--r--src/main/js/package.json5
-rw-r--r--src/main/js/src/components/.gitkeep0
-rw-r--r--src/main/js/src/components/errors/Error404.js6
-rw-r--r--src/main/js/src/containers/.gitkeep0
-rw-r--r--src/main/js/src/containers/Counter/actions.js12
-rw-r--r--src/main/js/src/containers/Counter/index.js68
-rw-r--r--src/main/js/src/containers/Counter/reducer.js24
-rw-r--r--src/main/js/src/containers/Counter/saga.js6
-rw-r--r--src/main/js/src/global-styles.css9
-rw-r--r--src/main/js/src/index.js14
-rw-r--r--src/main/js/src/reducers.js6
-rw-r--r--src/main/js/src/store.js38
-rw-r--r--src/main/js/yarn.lock39
14 files changed, 146 insertions, 90 deletions
diff --git a/src/main/js/.editorconfig b/src/main/js/.editorconfig
new file mode 100644
index 00000000..32c3b3d4
--- /dev/null
+++ b/src/main/js/.editorconfig
@@ -0,0 +1,9 @@
+root = false
+
+[*]
+end_of_line = lf
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
+indent_style = space
+indent_size = 2 \ No newline at end of file
diff --git a/src/main/js/package.json b/src/main/js/package.json
index 0c1bdbb9..b3ad0282 100644
--- a/src/main/js/package.json
+++ b/src/main/js/package.json
@@ -11,10 +11,13 @@
"react-dom": "^15.4.1",
"react-redux": "^5.0.1",
"react-router": "4.0.0-alpha.6",
+ "rebass": "^0.3.3",
+ "reflexbox": "^2.2.3",
"redux": "^3.6.0",
"redux-saga": "^0.13.0",
"sockjs-client": "latest",
- "webstomp-client": "^1.0.3"
+ "webstomp-client": "^1.0.3",
+ "redux-saga": "^0.13.0"
},
"scripts": {
"start": "react-scripts start",
diff --git a/src/main/js/src/components/.gitkeep b/src/main/js/src/components/.gitkeep
deleted file mode 100644
index e69de29b..00000000
--- a/src/main/js/src/components/.gitkeep
+++ /dev/null
diff --git a/src/main/js/src/components/errors/Error404.js b/src/main/js/src/components/errors/Error404.js
index 13ce5ae5..b657482d 100644
--- a/src/main/js/src/components/errors/Error404.js
+++ b/src/main/js/src/components/errors/Error404.js
@@ -1,8 +1,8 @@
import React from 'react'
import { Link } from 'react-router'
-const Error404 = () => <div>
- <h1>No Match</h1>
- <Link to="/">Take me back home ! 🏠</Link>
+const Error404 = () => <div>
+ <h1>No Match</h1>
+ <Link to="/">Take me back home ! 🏠</Link>
</div>
export default Error404 \ No newline at end of file
diff --git a/src/main/js/src/containers/.gitkeep b/src/main/js/src/containers/.gitkeep
deleted file mode 100644
index e69de29b..00000000
--- a/src/main/js/src/containers/.gitkeep
+++ /dev/null
diff --git a/src/main/js/src/containers/Counter/actions.js b/src/main/js/src/containers/Counter/actions.js
index 01cd8d67..abd6babb 100644
--- a/src/main/js/src/containers/Counter/actions.js
+++ b/src/main/js/src/containers/Counter/actions.js
@@ -1,20 +1,20 @@
import {
- INCREMENT, DECREMENT,
- INCREMENT_IF_ODD, INCREMENT_ASYNC
+ INCREMENT, DECREMENT,
+ INCREMENT_IF_ODD, INCREMENT_ASYNC
} from './constants'
export const increment = () => ({
- type: INCREMENT
+ type: INCREMENT
})
export const decrement = () => ({
- type: DECREMENT
+ type: DECREMENT
})
export const incrementIfOdd = () => ({
- type: INCREMENT_IF_ODD
+ type: INCREMENT_IF_ODD
})
export const incrementAsync = () => ({
- type: INCREMENT_ASYNC
+ type: INCREMENT_ASYNC
}) \ No newline at end of file
diff --git a/src/main/js/src/containers/Counter/index.js b/src/main/js/src/containers/Counter/index.js
index a91af8f5..0be665fd 100644
--- a/src/main/js/src/containers/Counter/index.js
+++ b/src/main/js/src/containers/Counter/index.js
@@ -2,50 +2,50 @@ import React, { PropTypes } from 'react'
import { connect } from 'react-redux'
import {
- increment,
- decrement,
- incrementAsync,
- incrementIfOdd
+ increment,
+ decrement,
+ incrementAsync,
+ incrementIfOdd
} from './actions'
-const Counter = ({ value, increment, decrement, incrementIfOdd, incrementAsync }) =>
- <p>
- Clicked: {value} times
- {' '}
- <button onClick={increment}>
- +
- </button>
- {' '}
- <button onClick={decrement}>
- -
- </button>
- {' '}
- <button onClick={incrementIfOdd}>
- Increment if odd
- </button>
- {' '}
- <button onClick={incrementAsync}>
- Increment async
- </button>
- </p>
+const Counter = ({value, increment, decrement, incrementIfOdd, incrementAsync}) =>
+ <p>
+ Clicked: {value} times
+ {' '}
+ <button onClick={increment}>
+ +
+ </button>
+ {' '}
+ <button onClick={decrement}>
+ -
+ </button>
+ {' '}
+ <button onClick={incrementIfOdd}>
+ Increment if odd
+ </button>
+ {' '}
+ <button onClick={incrementAsync}>
+ Increment async
+ </button>
+ </p>
Counter.propTypes = {
- value: PropTypes.number.isRequired,
- increment: PropTypes.func.isRequired,
- decrement: PropTypes.func.isRequired,
- incrementAsync: PropTypes.func.isRequired,
- incrementIfOdd: PropTypes.func.isRequired
+ value: PropTypes.number.isRequired,
+ increment: PropTypes.func.isRequired,
+ decrement: PropTypes.func.isRequired,
+ incrementAsync: PropTypes.func.isRequired,
+ incrementIfOdd: PropTypes.func.isRequired
}
const mapStateToProps = (state) => ({
- value: state.counter
+ value: state.counter
})
const mapDispatchToProps = {
- increment,
- decrement,
- incrementAsync,
- incrementIfOdd
+ increment,
+ decrement,
+ incrementAsync,
+ incrementIfOdd
}
export default connect(mapStateToProps, mapDispatchToProps)(Counter) \ No newline at end of file
diff --git a/src/main/js/src/containers/Counter/reducer.js b/src/main/js/src/containers/Counter/reducer.js
index 586c4e0a..44006f3e 100644
--- a/src/main/js/src/containers/Counter/reducer.js
+++ b/src/main/js/src/containers/Counter/reducer.js
@@ -1,17 +1,17 @@
import {
- INCREMENT, DECREMENT,
- INCREMENT_IF_ODD
+ INCREMENT, DECREMENT,
+ INCREMENT_IF_ODD
} from './constants'
export default function reducer(state = 0, action) {
- switch (action.type) {
- case INCREMENT:
- return state + 1
- case DECREMENT:
- return state - 1
- case INCREMENT_IF_ODD:
- return (state % 2 === 0) ? state + 1 : state
- default:
- return state
- }
+ switch (action.type) {
+ case INCREMENT:
+ return state + 1
+ case DECREMENT:
+ return state - 1
+ case INCREMENT_IF_ODD:
+ return (state % 2 === 0) ? state + 1 : state
+ default:
+ return state
+ }
} \ No newline at end of file
diff --git a/src/main/js/src/containers/Counter/saga.js b/src/main/js/src/containers/Counter/saga.js
index fe210620..0b9e2866 100644
--- a/src/main/js/src/containers/Counter/saga.js
+++ b/src/main/js/src/containers/Counter/saga.js
@@ -5,10 +5,10 @@ import { increment } from './actions'
import { INCREMENT_ASYNC } from './constants'
export function* incrementAsync() {
- yield call(delay, 1000)
- yield put(increment())
+ yield call(delay, 1000)
+ yield put(increment())
}
export default function* counterSaga() {
- yield takeEvery(INCREMENT_ASYNC, incrementAsync)
+ yield takeEvery(INCREMENT_ASYNC, incrementAsync)
} \ No newline at end of file
diff --git a/src/main/js/src/global-styles.css b/src/main/js/src/global-styles.css
index b4cc7250..4b644b66 100644
--- a/src/main/js/src/global-styles.css
+++ b/src/main/js/src/global-styles.css
@@ -1,5 +1,10 @@
+* { box-sizing: border-box; }
+
body {
margin: 0;
padding: 0;
- font-family: sans-serif;
-}
+ font-family: -apple-system, BlinkMacSystemFont, sans-serif;
+ line-height: 1.5;
+ color: #111;
+ background-color: #fff;
+} \ No newline at end of file
diff --git a/src/main/js/src/index.js b/src/main/js/src/index.js
index 926c756a..97af0f59 100644
--- a/src/main/js/src/index.js
+++ b/src/main/js/src/index.js
@@ -16,13 +16,13 @@ import Error404 from './components/errors/Error404'
ReactDOM.render(
<Provider store={store}>
- <BrowserRouter>
- <div className="app">
- <Match exactly pattern="/" component={App} />
- <Match exactly pattern="/counter" component={Counter}/>
- <Miss component={Error404} />
- </div>
- </BrowserRouter>
+ <BrowserRouter>
+ <div className="app">
+ <Match exactly pattern="/" component={App}/>
+ <Match exactly pattern="/counter" component={Counter}/>
+ <Miss component={Error404}/>
+ </div>
+ </BrowserRouter>
</Provider>,
document.getElementById('root')
);
diff --git a/src/main/js/src/reducers.js b/src/main/js/src/reducers.js
index 82540b00..79014615 100644
--- a/src/main/js/src/reducers.js
+++ b/src/main/js/src/reducers.js
@@ -2,7 +2,7 @@ import { combineReducers } from 'redux'
import counterReducer from './containers/Counter/reducer'
export default function createReducer() {
- return combineReducers({
- counter: counterReducer
- })
+ return combineReducers({
+ counter: counterReducer
+ })
} \ No newline at end of file
diff --git a/src/main/js/src/store.js b/src/main/js/src/store.js
index bbeb51bd..31c8aa71 100644
--- a/src/main/js/src/store.js
+++ b/src/main/js/src/store.js
@@ -5,29 +5,29 @@ import createSagaMiddleware from 'redux-saga'
import rootSaga from './sagas'
export default function configureStore(initialState = {}) {
- const sagaMiddleware = createSagaMiddleware()
+ const sagaMiddleware = createSagaMiddleware()
- const middlewares = [
- sagaMiddleware
- ]
+ const middlewares = [
+ sagaMiddleware
+ ]
- const enhancers = [
- applyMiddleware(...middlewares)
- ]
+ const enhancers = [
+ applyMiddleware(...middlewares)
+ ]
- const composeEnhancers =
- process.env.NODE_ENV !== 'production' &&
- typeof window === 'object' &&
- window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ?
- window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ : compose;
+ const composeEnhancers =
+ process.env.NODE_ENV !== 'production' &&
+ typeof window === 'object' &&
+ window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ?
+ window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ : compose;
- const store = createStore(
- createReducer(),
- initialState,
- composeEnhancers(...enhancers)
- )
+ const store = createStore(
+ createReducer(),
+ initialState,
+ composeEnhancers(...enhancers)
+ )
- sagaMiddleware.run(rootSaga)
+ sagaMiddleware.run(rootSaga)
- return store
+ return store
}
diff --git a/src/main/js/yarn.lock b/src/main/js/yarn.lock
index bd375f1c..5eeb79b4 100644
--- a/src/main/js/yarn.lock
+++ b/src/main/js/yarn.lock
@@ -1142,6 +1142,10 @@ clap@^1.0.9:
dependencies:
chalk "^1.1.3"
+classnames@^2.2.3:
+ version "2.2.5"
+ resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.2.5.tgz#fb3801d453467649ef3603c7d61a02bd129bde6d"
+
clean-css@3.4.x:
version "3.4.21"
resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-3.4.21.tgz#2101d5dbd19d63dbc16a75ebd570e7c33948f65b"
@@ -4193,6 +4197,10 @@ rc@~1.1.6:
minimist "^1.2.0"
strip-json-comments "~1.0.4"
+react-addons-pure-render-mixin@^15.3.1:
+ version "15.4.1"
+ resolved "https://registry.yarnpkg.com/react-addons-pure-render-mixin/-/react-addons-pure-render-mixin-15.4.1.tgz#8a1f48f9fd3f24ed12af63c4d2dc0c7529fa7e02"
+
react-broadcast@^0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/react-broadcast/-/react-broadcast-0.1.2.tgz#950de63578a2af399a396067a617af7402182330"
@@ -4360,6 +4368,14 @@ readline2@^1.0.1:
is-fullwidth-code-point "^1.0.0"
mute-stream "0.0.5"
+rebass:
+ version "0.3.3"
+ resolved "https://registry.yarnpkg.com/rebass/-/rebass-0.3.3.tgz#bfffddf219107b07be2133173bab9b9887098173"
+ dependencies:
+ classnames "^2.2.3"
+ object-assign "^4.0.1"
+ react-addons-pure-render-mixin "^15.3.1"
+
recursive-readdir@2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/recursive-readdir/-/recursive-readdir-2.1.0.tgz#78b7bfd79582d3d7596b8ff1bd29fbd50229f6aa"
@@ -4399,6 +4415,13 @@ redux-saga:
version "0.13.0"
resolved "https://registry.yarnpkg.com/redux-saga/-/redux-saga-0.13.0.tgz#9294386550deb0d56bc9a1b3c90a613e7ddb6593"
+reflexbox:
+ version "2.2.3"
+ resolved "https://registry.yarnpkg.com/reflexbox/-/reflexbox-2.2.3.tgz#9b9ce983dbe677cebf3a94cf2c50b8157f50c0d1"
+ dependencies:
+ robox "^1.0.0-beta.8"
+ ruled "^1.0.1"
+
regenerate@^1.2.1:
version "1.3.2"
resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.3.2.tgz#d1941c67bad437e1be76433add5b385f95b19260"
@@ -4555,6 +4578,16 @@ ripemd160@0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-0.2.0.tgz#2bf198bde167cacfa51c0a928e84b68bbe171fce"
+robox@^1.0.0-beta.8:
+ version "1.0.0-beta.8"
+ resolved "https://registry.yarnpkg.com/robox/-/robox-1.0.0-beta.8.tgz#9aaee1dacf38a8c4ca4584a80012aebab5711c73"
+ dependencies:
+ understyle "^1.2.0"
+
+ruled@^1.0.1:
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/ruled/-/ruled-1.0.1.tgz#8301a1accc9d2e14b6502fca7033582335c2c0f4"
+
run-async@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/run-async/-/run-async-0.1.0.tgz#c8ad4a5e110661e402a7d21b530e009f25f8e389"
@@ -5027,6 +5060,12 @@ uid-number@~0.0.6:
version "0.0.6"
resolved "https://registry.yarnpkg.com/uid-number/-/uid-number-0.0.6.tgz#0ea10e8035e8eb5b8e4449f06da1c730663baa81"
+understyle@^1.2.0:
+ version "1.3.0"
+ resolved "https://registry.yarnpkg.com/understyle/-/understyle-1.3.0.tgz#df3f9a9be96779d718c3da9598fad1c2f90f24ee"
+ dependencies:
+ object-assign "^4.1.0"
+
uniq@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/uniq/-/uniq-1.0.1.tgz#b31c5ae8254844a3a8281541ce2b04b865a734ff"
bgstack15