Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 42 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,5 @@
To begin the development, run `npm start`.
To create a production bundle, use `npm run build`.
-->
</body>
</body>
</html>
3 changes: 2 additions & 1 deletion src/components/ChangeTemperature.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import React from "react";
import store from "../store";

function ChangeTemperature(props){
return(
<div>
<br/>
<label>Change Temp - Enter a value from 1-100<br/>
<input onChange={(e)=>{

store.dispatch({type: "SET_TEMP", value: e.target.value})
}} type="number" min="0" max="100" />
</label>
</div>
Expand Down
3 changes: 2 additions & 1 deletion src/components/CityDropDown.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import React from 'react';
import store from "../store";

function CityDropDown(props) {
return (
<div>
CurrentCity:
<select onChange={
(e)=>{

store.dispatch({type: "SET_CURRENT_CITY", value: e.target.value})
}
}>
<option value="Austin">Austin</option>
Expand Down
11 changes: 11 additions & 0 deletions src/components/Counter.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
import React from 'react';
import store from "../store";

class Counter extends React.Component {

state={count:0}

componentDidMount(){
let currentCount = store.getState().currentCount;
this.setState({count:currentCount});
store.subscribe(()=>{
let currentCount = store.getState().currentCount;
this.setState({count:currentCount});
})
}

render() {
const {
props,
Expand Down
5 changes: 3 additions & 2 deletions src/components/CounterButton.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import React from 'react';
import store from '../store';

function CounterButton(props) {
return (
<div>
<button onClick={
()=>{

store.dispatch({type:"INCREASE_COUNTER"})
}
}>Increase Counter By One</button>
<button onClick={
()=>{

store.dispatch({type:"DECREASE_COUNTER"})
}
}>Decrease Counter By One</button>
</div>
Expand Down
10 changes: 10 additions & 0 deletions src/components/CurrentCity.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
import React from 'react';
import store from "../store";

class CurrentCity extends React.Component {
state={
text:""
}

componentDidMount(){
let currentCity = store.getState().currentCity;
this.setState({text:currentCity});
store.subscribe(()=>{
let currentCity = store.getState().currentCity;
this.setState({text:currentCity});
})
}

render() {
const {
props,
Expand Down
13 changes: 11 additions & 2 deletions src/components/Modal.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,33 @@
import React from 'react';
import Modal from 'react-modal';
import store from "../store";

class LoadingModal extends React.Component {
state={
isLoading:false
}

componentDidMount(){
store.subscribe(()=>{
let isLoading = store.getState().isLoading;
this.setState({isLoading:isLoading});
})
}

render() {
const {
props,
} = this;

return (
<Modal
isOpen={props.isLoading}
isOpen={this.state.isLoading}
style={customStyles}
contentLabel="Example Modal"
>
<button onClick={
()=>{

store.dispatch({type: "SET_IS_LOADING", value: false})
}
}>close</button>
<div>Loading .......</div>
Expand Down
3 changes: 2 additions & 1 deletion src/components/ScaleVideo.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import React from 'react';
import store from "../store";

function ScaleVideo(props) {
return (
<div>
Scale Video: <input
onChange={
(e)=>{

store.dispatch({type: "SET_VIDEO_SCALE", value: e.target.value})
}
}
type="range" min="1" max="10" step="1" />
Expand Down
3 changes: 2 additions & 1 deletion src/components/SearchTextBox.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import React from 'react';
import store from "../store";

function SearchTextBox(props) {
return (
<div>
Search Users on First Name:
<input onChange={(e)=>{

store.dispatch({type: "SET_SEARCH_TEXT", value: e.target.value})
}} />
</div>
);
Expand Down
Loading