diff --git a/src/App.js b/src/App.js index 392ed1f..3850d9b 100644 --- a/src/App.js +++ b/src/App.js @@ -1,24 +1,34 @@ -import React from 'react'; -import CounterButton from "./components/CounterButton"; -import SpecialTextBox from "./components/SpecialTextBox"; -import Counter from "./components/Counter"; -import SpecialText from "./components/SpecialText"; -import UserButtons from "./components/UserButtons"; -import Thermostat from "./components/Thermostat"; -import Users from "./components/Users"; -import ChangeTemperature from "./components/ChangeTemperature"; -import VideoPlayer from "./components/VideoPlayer"; -import VideoTextBox from "./components/VideoTextBox"; -import CurrentCity from "./components/CurrentCity"; -import CityDropDown from "./components/CityDropDown"; -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 React from 'react' +import CounterButton from "./containers/CounterButtonContainer"; +import SpecialTextBox from "./containers/SpecialTextBoxContainer"; +import Counter from "./containers/CounterContainer"; +import SpecialText from "./containers/SpecialTextContainer"; +import UserButtons from "./containers/UserButtonsContainer"; +import Thermostat from "./containers/ThermostatContainer"; +import Users from "./containers/UsersContainer"; +import ChangeTemperature from "./containers/ChangeTemperatureContainer"; +import VideoPlayer from "./containers/VideoPlayerContainer"; +import VideoTextBox from "./containers/VideoTextBoxContainer"; +import CurrentCity from "./containers/CurrentCityContainer"; +import CityDropDown from "./containers/CityDropDownContainer"; +import SearchTextBox from "./containers/SearchTextBoxContainer"; +import SortUsers from "./containers/SortUsersContainer"; +import ScaleVideo from "./containers/ScaleVideoContainer"; +import Modal from "./containers/ModalContainer"; +import ShowModal from "./containers/ShowModalContainer"; -function App() { - return ( +class App extends React.Component { + + + componentDidMount() { + fetch('https://jsonplaceholder.typicode.com/users') + .then(res => res.json()) + .then(data => {this.props.set(data)}) + .catch(err => console.log(`Error: ${err}`)) + } + + render() { + return (
@@ -28,7 +38,7 @@ function App() {
-
+

@@ -52,14 +62,13 @@ function App() {

- -
- ); + ); + } } export default App; \ No newline at end of file diff --git a/src/actions/index.js b/src/actions/index.js index 78955f4..63139d1 100644 --- a/src/actions/index.js +++ b/src/actions/index.js @@ -1,24 +1,100 @@ +export const INCREASE_COUNTER = "INCREASE_COUNTER"; +export const LOAD_USERS = "LOAD_USERS"; +export const DECREASE_COUNTER = "DECREASE_COUNTER" +export const SET_SPECIAL_TEXT= "SET_SPECIAL_TEXT" +export const ADD_USER = "ADD_USER" +export const REMOVE_USER = "REMOVE_USER" +export const SET_SEARCH_TEXT = "SET_SEARCH_TEXT" +export const SET_IS_LOADING = "SET_IS_LOADING" +export const SET_TEMP = "SET_TEMP" +export const SET_CURRENT_CITY = "SET_CURRENT_CITY" +export const SET_VIDEO_URL = "SET_VIDEO_URL" +export const SET_CURRENT_USER_SORT = "SET_CURRENT_USER_SORT" +export const SET_VIDEO_SCALE = "SET_VIDEO_SCALE" + export function increaseCounter(){ return { - type:"INCREASE_COUNTER" + type: INCREASE_COUNTER + } +} + +export function loadUsers(users) { + return { + type: LOAD_USERS, + value: users } } -export function setSpecialText(txt){ +export function decreaseCounter(){ return { - type:"SET_SPECIAL_TEXT", - value:txt + type:DECREASE_COUNTER + } +} + +export function setSpecialText(text){ + return { + type:SET_SPECIAL_TEXT, + value:text } } export function addUser(user){ return { - type:"ADD_USER", + type:ADD_USER, value:user } } export function removeUser(){ return { - type:"REMOVE_USER" + type:REMOVE_USER + } +} + +export function setSearchText(text){ + return { + type: SET_SEARCH_TEXT, + value: text + } +} + +export function setIsLoading(isLoading) { + return { + type: SET_IS_LOADING, + value: isLoading + } +} + +export function setTemp(temp) { + return { + type: SET_TEMP, + value: temp + } +} + +export function setCurrentCity(city) { + return { + type: SET_CURRENT_CITY, + value: city + } +} + +export function setVideoURL(URL) { + return { + type: SET_VIDEO_URL, + value: URL } -} \ No newline at end of file +} + +export function setCurrentUserSort(sort) { + return { + type: SET_CURRENT_USER_SORT, + value: sort + } +} + +export function setVideoScale(scale) { + return { + type: SET_VIDEO_SCALE, + value: scale + } +} diff --git a/src/components/Counter.js b/src/components/Counter.js index e858afd..f15c05f 100644 --- a/src/components/Counter.js +++ b/src/components/Counter.js @@ -7,4 +7,5 @@ function Counter(props) { ); } -export default Counter; \ No newline at end of file + +export default Counter; diff --git a/src/components/CounterButton.js b/src/components/CounterButton.js index df3a778..a97d6a6 100644 --- a/src/components/CounterButton.js +++ b/src/components/CounterButton.js @@ -12,7 +12,7 @@ function CounterButton(props) { }>Increase Counter By One