This file contains hidden or 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
import React, { Component } from "react"; | |
import { connect } from "react-redux"; | |
import { completeToDo } from "../actions"; | |
class ToDoListItem extends Component { | |
handleCompleteClick = completeToDoId => { | |
const { completeToDo } = this.props; | |
completeToDo(completeToDoId); | |
}; |
This file contains hidden or 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
import "./ToDoList.css"; | |
import React, { Component } from "react"; | |
import { connect } from "react-redux"; | |
import _ from "lodash"; | |
import * as actions from "../actions"; | |
import ToDoListItem from "./ToDoListItem"; | |
class ToDoList extends Component { | |
state = { | |
addFormVisible: false, |
This file contains hidden or 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
.to-do-list-container { | |
margin-top: 25px; | |
} | |
.to-do-list-item { | |
margin-top: 10px; | |
color: white; | |
transition: background-color 1s; | |
} |
This file contains hidden or 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
import React, { Component } from "react"; | |
import ToDoList from "./components/ToDoList"; | |
class App extends Component { | |
render() { | |
return ( | |
<div className="container"> | |
<ToDoList /> | |
</div> | |
); |
This file contains hidden or 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
import "./SignIn.css"; | |
import React, { Component } from "react"; | |
import { connect } from "react-redux"; | |
import { signIn } from "../actions"; | |
import PropTypes from "prop-types"; | |
class Signin extends Component { | |
static contextTypes = { | |
router: PropTypes.object | |
}; |
This file contains hidden or 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
import * as firebase from "firebase"; | |
import { FirebaseConfig } from "../config/keys"; | |
firebase.initializeApp(FirebaseConfig); | |
const databaseRef = firebase.database().ref(); | |
export const todosRef = databaseRef.child("todos"); | |
export const authRef = firebase.auth(); | |
export const provider = new firebase.auth.GoogleAuthProvider(); |
This file contains hidden or 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
import { todosRef, authRef, provider } from "../config/firebase"; | |
import { FETCH_TODOS, FETCH_USER } from "./types"; | |
export const addToDo = (newToDo, uid) => async dispatch => { | |
todosRef | |
.child(uid) | |
.push() | |
.set(newToDo); | |
}; |
This file contains hidden or 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
import { FETCH_USER } from "../actions/types"; | |
export default (state = false, action) => { | |
switch (action.type) { | |
case FETCH_USER: | |
return action.payload || null; | |
default: | |
return state; | |
} | |
}; |
This file contains hidden or 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
import { combineReducers } from "redux"; | |
import data from "./dataReducer"; | |
import auth from "./authReducer"; | |
export default combineReducers({ | |
data, | |
auth | |
}); |
This file contains hidden or 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
import React, { Component } from "react"; | |
import { connect } from "react-redux"; | |
import PropTypes from "prop-types"; | |
export default function(ComposedComponent) { | |
class Authentication extends Component { | |
static contextTypes = { | |
router: PropTypes.object | |
}; |