diff --git a/package-lock.json b/package-lock.json index ee9a1d2..e471952 100644 --- a/package-lock.json +++ b/package-lock.json @@ -881,11 +881,18 @@ } }, "@babel/runtime": { - "version": "7.3.4", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.3.4.tgz", - "integrity": "sha512-IvfvnMdSaLBateu0jfsYIpZTxAc2cKEXEMiezGGN75QcBcecDUKd3PgLAncT0oOgxKy8dd8hrJKj9MfzgfZd6g==", + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.4.0.tgz", + "integrity": "sha512-/eftZ45kD0OfOFHAmN02WP6N1NVphY+lBf8c2Q/P9VW3tj+N5NlBBAWfqOLOl96YDGMqpIBO5O/hQNx4A/lAng==", "requires": { - "regenerator-runtime": "^0.12.0" + "regenerator-runtime": "^0.13.2" + }, + "dependencies": { + "regenerator-runtime": { + "version": "0.13.2", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.2.tgz", + "integrity": "sha512-S/TQAZJO+D3m9xeN1WTI8dLKBBiRgXBlTJvbWjCThHWZj9EvHK70Ff50/tYj2J/fvBY6JtFVwRuazHN2E7M9BA==" + } } }, "@babel/template": { @@ -3166,7 +3173,8 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -3187,12 +3195,14 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -3207,17 +3217,20 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -3334,7 +3347,8 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -3346,6 +3360,7 @@ "version": "1.0.0", "bundled": true, "dev": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -3360,6 +3375,7 @@ "version": "3.0.4", "bundled": true, "dev": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -3367,12 +3383,14 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "minipass": { "version": "2.3.5", "bundled": true, "dev": true, + "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -3391,6 +3409,7 @@ "version": "0.5.1", "bundled": true, "dev": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -3471,7 +3490,8 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -3483,6 +3503,7 @@ "version": "1.4.0", "bundled": true, "dev": true, + "optional": true, "requires": { "wrappy": "1" } @@ -3568,7 +3589,8 @@ "safe-buffer": { "version": "5.1.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -3604,6 +3626,7 @@ "version": "1.0.2", "bundled": true, "dev": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -3623,6 +3646,7 @@ "version": "3.0.1", "bundled": true, "dev": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -3666,12 +3690,14 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "yallist": { "version": "3.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true } } }, @@ -7092,7 +7118,8 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -7113,12 +7140,14 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -7133,17 +7162,20 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -7260,7 +7292,8 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -7272,6 +7305,7 @@ "version": "1.0.0", "bundled": true, "dev": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -7286,6 +7320,7 @@ "version": "3.0.4", "bundled": true, "dev": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -7293,12 +7328,14 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "minipass": { "version": "2.2.4", "bundled": true, "dev": true, + "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -7317,6 +7354,7 @@ "version": "0.5.1", "bundled": true, "dev": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -7397,7 +7435,8 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -7409,6 +7448,7 @@ "version": "1.4.0", "bundled": true, "dev": true, + "optional": true, "requires": { "wrappy": "1" } @@ -7494,7 +7534,8 @@ "safe-buffer": { "version": "5.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -7530,6 +7571,7 @@ "version": "1.0.2", "bundled": true, "dev": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -7549,6 +7591,7 @@ "version": "3.0.1", "bundled": true, "dev": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -7592,12 +7635,14 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "yallist": { "version": "3.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true } } }, @@ -15034,7 +15079,8 @@ "regenerator-runtime": { "version": "0.12.1", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.12.1.tgz", - "integrity": "sha512-odxIc1/vDlo4iZcfXqRYFj0vpXFNoGdKMAUieAlFYO6m/nl5e9KR/beGf41z4a1FI+aQgtjhuaSlDxQ0hmkrHg==" + "integrity": "sha512-odxIc1/vDlo4iZcfXqRYFj0vpXFNoGdKMAUieAlFYO6m/nl5e9KR/beGf41z4a1FI+aQgtjhuaSlDxQ0hmkrHg==", + "dev": true }, "regenerator-transform": { "version": "0.13.4", diff --git a/package.json b/package.json index 0f713ab..c45cff5 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "react": "*", "react-dom": "*", "react-modal": "^1.7.7", - "react-redux": "*", + "react-redux": "^6.0.1", "redux": "*", "whatwg-fetch": "^2.0.3" }, diff --git a/src/App.js b/src/App.js index 392ed1f..a7eabe5 100644 --- a/src/App.js +++ b/src/App.js @@ -1,8 +1,8 @@ import React from 'react'; import CounterButton from "./components/CounterButton"; -import SpecialTextBox from "./components/SpecialTextBox"; +import SpecialTextBox from "containers/SpecialTextBoxContainer"; import Counter from "./components/Counter"; -import SpecialText from "./components/SpecialText"; +import SpecialText from "./containers/SpecialText"; import UserButtons from "./components/UserButtons"; import Thermostat from "./components/Thermostat"; import Users from "./components/Users"; diff --git a/src/components/SpecialTextBox.js b/src/components/SpecialTextBox.js index 53c3938..efe75d1 100644 --- a/src/components/SpecialTextBox.js +++ b/src/components/SpecialTextBox.js @@ -16,11 +16,9 @@ function SpecialTextBox(props) { } function mapDispatchToProps(dispatch){ - return { - set:function(txt){ - let action = setSpecialText(txt) - dispatch(action); - } + let mapDispatchToProps={ + set:setSpecialText + } } -export default (SpecialTextBox); \ No newline at end of file +export default connect(null,mapDispatchToProps)(SpecialTextBox) diff --git a/src/containers/CounterContainer.js b/src/containers/CounterContainer.js new file mode 100644 index 0000000..47524cd --- /dev/null +++ b/src/containers/CounterContainer.js @@ -0,0 +1,10 @@ +import { connect } from 'react-redux'; +import {increaseCounter} from "../actions"; +import {decreaseCounter} from "../actions"; +import Counter from "../components/Counter"; + +const mapDispatchToProps = { + set:setSpecialText + } + +export default connect(null,mapDispatchToProps)(Counter); \ No newline at end of file diff --git a/src/index.js b/src/index.js index 25f54ba..f9597f0 100644 --- a/src/index.js +++ b/src/index.js @@ -2,9 +2,12 @@ import React from 'react'; import ReactDOM from 'react-dom'; import App from './App'; import './index.css'; +import {Provider} from "react-redux" ReactDOM.render( - , + + + , document.getElementById('root') ); diff --git a/src/reducers/index.js b/src/reducers/index.js index dce7c2c..5bbfdea 100644 --- a/src/reducers/index.js +++ b/src/reducers/index.js @@ -1,20 +1,75 @@ +import { combineReducers } from "redux"; + function currentCount(state=0, action){ if(action.type === "INCREASE_COUNTER"){ - + return state+1 } if(action.type === "DECREASE_COUNTER"){ - + return state-1 } return state; } +function currentCity(state="", action){ + if(action.type === ""){ + + } + return state +} + +function searchText(state="", action){ + if(action.type === ""){ + + } + return state +} + +function currentTemp(state=0, action){ + if(action.type === ""){ + + } + return state +} + +function isLoading(state=false, action){ + if(action.type === ""){ + + } + return state +} + +function videoURL(state="", action){ + if (action.type === ""){ + + } + return state +} + +function currentUserSort(state="first_name", action){ + if (action.type === ""){ + + } + return state +} + +function videoScale(state=1, action){ + if (action.type === ""){ + + } + return state +} + function users(state =[], action){ if(action.type === "ADD_USER"){ + // let newArray = state.map(p=>p); + // newArray.push(action.value); + // return newArray; + return [...state, action.value]; } if(action.type === "REMOVE_USER"){ - + return state.splice() } return state; } @@ -27,3 +82,8 @@ function specialText(state = "", action){ return state; } +let reducers = combineReducers({ + currentCount,users,specialText,currentCity,searchText, currentTemp,isLoading,videoURL,currentUserSort,videoScale +}) + +export default reducers; \ No newline at end of file