Skip to content

Commit

Permalink
feat(Counter): add Counter view
Browse files Browse the repository at this point in the history
  • Loading branch information
kiki-le-singe committed Jan 8, 2017
1 parent 4cb5fc1 commit 90ce274
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/common/views/CounterView/CounterView.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React, { PropTypes } from 'react'
import Helmet from 'react-helmet'

export default function CounterView({ counter, increment, decrement }) {
return (
<div className="view view__counter">
<Helmet title="Counter" />

<h2>Counter: {counter}</h2>

<div className="view__content">
<button onClick={increment}>Increment</button>
<button onClick={decrement}>Decrement</button>
</div>
</div>
)
}

CounterView.propTypes = {
counter: PropTypes.number,
increment: PropTypes.func,
decrement: PropTypes.func,
}
12 changes: 12 additions & 0 deletions src/common/views/CounterView/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { connect } from 'react-redux'

import { actions } from 'common/redux/actions/CounterActions'
import CounterView from './CounterView'

const mapStateToProps = state => ({
counter: state.counter
})

const connectedCounterView = connect(mapStateToProps, actions)(CounterView)

export { connectedCounterView as default, CounterView }

0 comments on commit 90ce274

Please sign in to comment.