Skip to content

Instantly share code, notes, and snippets.

View ryanjyost's full-sized avatar

Ryan Yost ryanjyost

View GitHub Profile
@ryanjyost
ryanjyost / Pre-Redux: TotalExpenses.js
Created January 11, 2017 04:33
Pre-Redux: rainy-day-fund/src/components/TotalExpenses.js
//src/components/TotalExpenses.js
import React from 'react';
import {formatDollarValues} from '../helpers'
const TotalExpenses = () => {
return (
<div id="TotalExpenses">
<h3>Total Monthly Expenses</h3>
{' '}
@ryanjyost
ryanjyost / Pre-Redux: SavingsPlan.js
Last active January 11, 2017 04:39
Pre-Redux: rainy-day-fund/src/components/SavingsPlan.js
//src/components/SavingsPlan.js
import React from 'react';
import { FormControl, InputGroup } from 'react-bootstrap';
import {formatDollarValues} from '../helpers'
const SavingsPlan = () => {
return (
@ryanjyost
ryanjyost / Pre-Redux: index.js
Last active January 15, 2017 21:39
Pre-Redux: rainy-day-fund/src/index.js
//src/index.js
import React from 'react';
import ReactDOM from 'react-dom';
import 'bootstrap/dist/css/bootstrap.css';
import 'bootstrap/dist/css/bootstrap-theme.css';
import './index.css';
import router from './router';
@ryanjyost
ryanjyost / router.js
Last active January 15, 2017 21:41
rainy-day-fund/src/components/router.js
//src/router.js
import React from 'react'
import { Router, Route, hashHistory, IndexRoute } from 'react-router'
import App from './components/App'
import Landing from './components/Landing'
import WhatIsARainyDayFund from './components/WhatIsARainyDayFund'
import Assumptions from './components/Assumptions'
import Expenses from './components/Expenses'
@ryanjyost
ryanjyost / Final: actions.js
Last active January 22, 2017 19:00
rainy-day-fund/src/actions.js
//src/actions.js
//=============================================
// Assumptions
//action types
export const UPDATE_INCOME_SOURCES = 'UPDATE_INCOME_SOURCES';
export const UPDATE_INCOME = 'UPDATE_INCOME';
export const UPDATE_SAVINGS = 'UPDATE_SAVINGS';
@ryanjyost
ryanjyost / Pre-Redux: Expense.js
Last active January 22, 2017 20:46
Pre-Redux: rainy-day-fund/src/components/Expense.js
//src/components/Expense.js
import React from 'react';
import {FormControl, InputGroup } from 'react-bootstrap';
import {formatDollarValues} from '../helpers'
const Expense = () => {
return (
<li className="expense-item">
@ryanjyost
ryanjyost / Final: reducers.js
Last active January 22, 2017 20:57
rainy-day-fund/src/reducers/reducers.js
//src/reducers/reducers.js
import * as types from '../actions';
//=================================
// Assumptions Reducer
//=================================
const initialAssumptionsState = {
incomeSources: 1,
@ryanjyost
ryanjyost / Final: reducers_index.js
Created January 22, 2017 21:00
rainy-day-fund/src/reducers/index.js
//src/reducers/index.js
import { combineReducers } from 'redux';
import { assumptionsReducer, expensesReducer, savingsPlanReducer } from './reducers';
const appReducer = combineReducers({
assumptions: assumptionsReducer,
expenses: expensesReducer,
savingsPlan: savingsPlanReducer
@ryanjyost
ryanjyost / Final: AssumptionsContainer.js
Last active January 22, 2017 21:10
rainy-day-fund/src/components/AssumptionsContainer.js
//src/components/AssumptionsContainer
import { connect } from 'react-redux';
import { updateIncomeSources, updateIncome, updateSavings } from '../actions'
import Assumptions from './Assumptions'
const mapStateToProps = (state) => {
return {
assumptions: state.assumptions,
}
@ryanjyost
ryanjyost / Final: ExpensesContainer.js
Last active January 22, 2017 21:27
rainy-day-fund/src/components/ExpensesContainer.js
//src/components/ExpensesContainer
import Expenses from './Expenses'
import { connect } from 'react-redux';
import {addExpense, removeExpense, updateExpenseName, updateExpenseAmount} from '../actions'
const mapStateToProps = (state) => {
return {
expenses: state.expenses,
}