diff --git a/README.md b/README.md
index 338b5b3..b769a88 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# Make sure to do one thing at a time, save and refresh to check for errors
+ # Make sure to do one thing at a time, save and refresh to check for errors
### Setup
Fork, clone, npm i, npm start
diff --git a/package-lock.json b/package-lock.json
index ee9a1d2..d7bb883 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -3187,12 +3187,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 +3209,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 +3339,8 @@
"inherits": {
"version": "2.0.3",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"ini": {
"version": "1.3.5",
@@ -3346,6 +3352,7 @@
"version": "1.0.0",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
@@ -3360,6 +3367,7 @@
"version": "3.0.4",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
@@ -3367,12 +3375,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 +3401,7 @@
"version": "0.5.1",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"minimist": "0.0.8"
}
@@ -3471,7 +3482,8 @@
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"object-assign": {
"version": "4.1.1",
@@ -3483,6 +3495,7 @@
"version": "1.4.0",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"wrappy": "1"
}
@@ -3604,6 +3617,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",
@@ -7113,12 +7127,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 +7149,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 +7279,8 @@
"inherits": {
"version": "2.0.3",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"ini": {
"version": "1.3.5",
@@ -7272,6 +7292,7 @@
"version": "1.0.0",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
@@ -7286,6 +7307,7 @@
"version": "3.0.4",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
@@ -7293,12 +7315,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 +7341,7 @@
"version": "0.5.1",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"minimist": "0.0.8"
}
@@ -7397,7 +7422,8 @@
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"object-assign": {
"version": "4.1.1",
@@ -7409,6 +7435,7 @@
"version": "1.4.0",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"wrappy": "1"
}
@@ -7530,6 +7557,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",
diff --git a/src/App.js b/src/App.js
index 392ed1f..086a1f5 100644
--- a/src/App.js
+++ b/src/App.js
@@ -1,65 +1,79 @@
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/SpecialTextContainer";
import UserButtons from "./components/UserButtons";
-import Thermostat from "./components/Thermostat";
+import Thermostat from "./containers/ThermostatContainer";
import Users from "./components/Users";
-import ChangeTemperature from "./components/ChangeTemperature";
+import ChangeTemperature from "./containers/ChangeTempContainer";
import VideoPlayer from "./components/VideoPlayer";
import VideoTextBox from "./components/VideoTextBox";
-import CurrentCity from "./components/CurrentCity";
-import CityDropDown from "./components/CityDropDown";
+import CurrentCity from "./containers/CurrentCityContainer";
+import CityDropDown from "./containers/CityDropDownContainer";
import SearchTextBox from "./components/SearchTextBox";
import SortUsers from "./components/SortUsers";
import ScaleVideo from "./components/ScaleVideo";
-import Modal from "./components/Modal";
-import ShowModal from "./components/ShowModal";
+import Modal from "./containers/ModalContainer";
+import ShowModal from "./containers/ShowModalContainer";
+import store from './store';
-function App() {
- return (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+class App extends React.Component {
+
+ componentDidMount() {
+ fetch('https://jsonplaceholder.typicode.com/users')
+ .then(res => res.json())
+ .then(users => {
+ let message = {value: users, type:'USERS_LOADED'};
+ store.dispatch(message)
+ })
+ }
+
+ render() {
+
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
- );
+ )
+ };
}
export default App;
\ No newline at end of file
diff --git a/src/actions/index.js b/src/actions/index.js
index 78955f4..d222978 100644
--- a/src/actions/index.js
+++ b/src/actions/index.js
@@ -1,6 +1,14 @@
+export const INCREASE_COUNTER = 'INCREASE_COUNTER';
+
export function increaseCounter(){
return {
- type:"INCREASE_COUNTER"
+ type:INCREASE_COUNTER
+ }
+}
+
+export function decreaseCounter() {
+ return {
+ type:"DECREASE_COUNTER"
}
}
@@ -21,4 +29,32 @@ export function removeUser(){
return {
type:"REMOVE_USER"
}
+}
+
+export function setCurrentCity(city) {
+ return {
+ type: "SET_CURRENT_CITY",
+ value: city
+ }
+}
+
+export function setTemp(temp) {
+ return {
+ type: 'SET_TEMP',
+ value: temp
+ }
+}
+
+export function setIsLoading(isLoading) {
+ return {
+ type: 'SET_IS_LOADING',
+ value: isLoading
+ }
+}
+
+export function setVideoURL(url) {
+ return {
+ type: 'SET_VIDEO_URL',
+ value: url
+ }
}
\ No newline at end of file
diff --git a/src/components/Counter.js b/src/components/Counter.js
index e858afd..f9422fc 100644
--- a/src/components/Counter.js
+++ b/src/components/Counter.js
@@ -1,4 +1,5 @@
import React from 'react';
+import {connect} from 'react-redux';
function Counter(props) {
return (
@@ -7,4 +8,11 @@ function Counter(props) {
);
}
-export default Counter;
\ No newline at end of file
+
+const mapStateToProps = (state) => {
+ return {
+ count: state.currentCount
+ }
+}
+
+export default connect(mapStateToProps, null)(Counter);
\ No newline at end of file
diff --git a/src/components/CounterButton.js b/src/components/CounterButton.js
index df3a778..53a014d 100644
--- a/src/components/CounterButton.js
+++ b/src/components/CounterButton.js
@@ -1,4 +1,6 @@
import React from 'react';
+import {connect} from 'react-redux';
+import {increaseCounter, decreaseCounter} from '../actions/index';
function CounterButton(props) {
return (
@@ -12,7 +14,7 @@ function CounterButton(props) {
}>Increase Counter By One