Skip to content
This repository has been archived by the owner on Oct 10, 2022. It is now read-only.

Commit

Permalink
First working example with all Redux components
Browse files Browse the repository at this point in the history
  • Loading branch information
GuLinux committed Feb 22, 2018
1 parent 5895d3f commit 50faac0
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .vimrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
let g:ctrlp_working_path_mode = 'a'
let g:ctrlp_user_command = 'cd %s && git ls-files -co --exclude-standard'
2 changes: 2 additions & 0 deletions indi-lite-frontend/.vimrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
let g:ctrlp_working_path_mode = 'a'
let g:ctrlp_user_command = 'cd %s && git ls-files -co --exclude-standard'
5 changes: 3 additions & 2 deletions indi-lite-frontend/src/components/App.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import React, { Component } from 'react';
import './App.css';
import SequencesList from './SequencesList';
import VisibleSequences from '../containers/VisibleSequences';

class App extends Component {
render() {
return (
<div className="App">
<SequencesList />
<p>Hello, React!</p>
<VisibleSequences />
</div>
);
}
Expand Down
4 changes: 2 additions & 2 deletions indi-lite-frontend/src/components/SequencesList.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from 'react';


const SequencesList = ({sequences}) => {
const SequencesList = ({sequences}) => (
<ul>
{sequences.map(sequence => (
<p>{sequence.name}</p>
))}
</ul>
}
)

export default SequencesList;
34 changes: 34 additions & 0 deletions indi-lite-frontend/src/containers/VisibleSequences.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { connect } from 'react-redux'
import SequencesList from '../components/SequencesList'

const getVisibleSequences = (sequences) => {
return sequences;
/* switch (filter) {
case 'SHOW_ALL':
return todos
case 'SHOW_COMPLETED':
return todos.filter(t => t.completed)
case 'SHOW_ACTIVE':
return todos.filter(t => !t.completed)
}
*/
}

const mapStateToProps = state => {
return {
sequences: getVisibleSequences(state.sequences)
}
}

const mapDispatchToProps = dispatch => {
return {
}
}

const VisibleSequences = connect(
mapStateToProps,
mapDispatchToProps
)(SequencesList)

export default VisibleSequences

0 comments on commit 50faac0

Please sign in to comment.