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

My branch #55

Open
wants to merge 6 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
22 changes: 22 additions & 0 deletions learn-redux/client/actions/actionCreators.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
export function increment (index) {
return {
type: 'INCREMENT_LIKES',
index
}
}

export function addComment(postId, author, comment) {
return {
type: 'ADD_COMMENT',
postId,
author,
comment
}
}

export function removeComment(postId, i) {
return {
type: 'REMOVE_COMMENT',
i
}
}
18 changes: 18 additions & 0 deletions learn-redux/client/components/Main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react'
import { Link } from 'react-router';

const Main = React.createClass({
render() {
return (
<div>
<h1>
<Link to="/">Reduxstagram</Link>
</h1>
{React.cloneElement(this.props.children, this.props)}
</div>
)
}
});

export default Main;

12 changes: 12 additions & 0 deletions learn-redux/client/components/PhotoGrid.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react'

const PhotoGrid = () => {
return (
<div className="photo-grid">
I'm the photo grid
</div>
)
};

export default PhotoGrid;

11 changes: 11 additions & 0 deletions learn-redux/client/components/Single.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react'

const Single = () => {
return (
<div className="single-photo">
I'm the single
</div>
)
};

export default Single;
24 changes: 23 additions & 1 deletion learn-redux/client/reduxstagram.js
Original file line number Diff line number Diff line change
@@ -1 +1,23 @@
// let's go!
import React from 'react';
import {render} from 'react-dom';

import css from './styles/style.styl';

import Main from './components/Main';
import Single from './components/Single';
import PhotoGrid from './components/PhotoGrid';

import { Router, Route, IndexRoute, browserHistory} from 'react-router'

const router = (
<Router history={browserHistory}>
<Route path="/" component={Main}>
<IndexRoute component={PhotoGrid}>
<Route path='/view/:postId'>
</Route>
</IndexRoute>
</Route>
</Router>
)

render(router, document.getElementById('root'));
19 changes: 19 additions & 0 deletions learn-redux/client/store.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { createStore, compse } from 'redux';
import { syncHistoryWithStore } from 'react-router-redux';
import { browserHistory } from 'react-router';

import rootReducer from './reducers/index';

import comments from './data/comments';
import posts from './data/posts';

const defaultState = {
posts,
comments
}

const store = createStore(rootReducer, defaultState);

export const history = syncHistoryWithStore(browserHistory, store);

export default store;
Loading