Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code Clean up #3

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"dependencies": {
"autoprefixer": "^6.3.6",
"history": "^2.1.1",
"lodash": "^4.12.0",
"react": "0.14.7",
"react-dom": "0.14.7",
"react-ga": "^1.4.1",
Expand All @@ -27,6 +26,7 @@
"babel-eslint": "^6.0.4",
"babel-loader": "6.2.2",
"babel-plugin-syntax-object-rest-spread": "^6.5.0",
"babel-plugin-transform-class-properties": "^6.9.1",
"babel-plugin-transform-object-rest-spread": "^6.6.5",
"babel-preset-es2015": "^6.6.0",
"babel-preset-react": "6.5.0",
Expand Down
3 changes: 1 addition & 2 deletions src/components/components/Breadcrumbs.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import React, { PropTypes } from 'react';

import { Link } from 'react-router';
import { map } from 'lodash';

const BreadCrumbs = ({ links }) => (
<span className="breadcrumbs">
{ map(links, (link, i) => (
{ links.map((link, i) => (
<span key={i}>
<Link to={link.href}>{link.name}</Link>
</span>
Expand Down
3 changes: 1 addition & 2 deletions src/components/views/Entries/Entries.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import React, { PropTypes } from 'react';
import { connect } from 'react-redux';
import { map } from 'lodash';

import SingleEntry from './SingleEntry';

let Entries = ({ entries }) => (
<span>
{ map(entries, entry =>
{ entries.map(entry =>
<SingleEntry title={entry.title} key={`${entry.title}_id`} content={entry.content} />
)}
</span>
Expand Down
23 changes: 16 additions & 7 deletions src/components/views/Post/PostContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,11 @@ class PostContainerComponent extends Component {
title: '',
content: '',
};

this.onPublishClick = this.onPublishClick.bind(this);
this.onChange = this.onChange.bind(this);
}

onPublishClick() {
const { dispatch } = this.props;
dispatch(fetchPostEntry(this.state));
const { fetchPost } = this.props;
fetchPost(this.state);
}

onChange(e) {
Expand All @@ -32,10 +29,22 @@ class PostContainerComponent extends Component {
}

render() {
const { title, content } = this.state
return (
<Post {...this} {...this.state} />
<Post
onChange={this.onChange.bind(this)}
onPublishClick={this.onPublishClick.bind(this)}
title={title}
content={content}
/>
);
}
}

export const PostContainer = connect()(PostContainerComponent);
export const mapDispatchToProps = (dispatch) => ({
fetchPost: (post) => {
dispatch(fetchPostEntry(post))
}
})

export const PostContainer = connect(null, mapDispatchToProps)(PostContainerComponent);