-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#1] - Refactored Header and ToolBar container.
- Loading branch information
Showing
9 changed files
with
91 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export ToolBar from './Header/ToolBar' | ||
export Header from './Header/Header' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { bindActionCreators } from 'redux' | ||
import { connect } from 'react-redux' | ||
|
||
import { Header } from '../components' | ||
import * as actionCreators from '../redux/actions' | ||
|
||
function mapStateToProps(state) { | ||
return { | ||
...state, | ||
pathname: state.routing.locationBeforeTransitions.pathname | ||
} | ||
} | ||
|
||
function mapDispatchToProps(dispatch) { | ||
return bindActionCreators(actionCreators, dispatch) | ||
} | ||
|
||
export default connect( | ||
mapStateToProps, | ||
mapDispatchToProps | ||
)(Header) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import React, { Component, PropTypes } from 'react' | ||
import { connect } from 'react-redux' | ||
import { withRouter } from 'react-router' | ||
import { ToolBar } from '../components' | ||
|
||
class ToolBarContainer extends Component { | ||
constructor(props) { | ||
super(props) | ||
console.info('ToolBarContainer', props) | ||
} | ||
|
||
render() { | ||
return ( | ||
<ToolBar | ||
posts={this.props.posts} | ||
router={this.props.router} | ||
/> | ||
) | ||
} | ||
} | ||
|
||
ToolBarContainer.propTypes = { | ||
posts: PropTypes.array.isRequired, | ||
router: React.PropTypes.shape({ | ||
push: React.PropTypes.func.isRequired | ||
}).isRequired | ||
} | ||
ToolBarContainer.defaultProps = {} | ||
|
||
function mapStateToProps(state) { | ||
return { posts: state.articleSummary.paginator } | ||
} | ||
|
||
export default connect( | ||
mapStateToProps | ||
)(withRouter(ToolBarContainer)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export AppContainer from './AppContainer' | ||
export BlogContainer from './BlogContainer' | ||
export ToolBarContainer from './ToolBarContainer' | ||
export HeaderContainer from './HeaderContainer' | ||
export Root from './Root' | ||
export DevTools from './DevTools' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters