This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import "Header"; | |
@import "WeatherForm"; | |
@import "Container"; | |
@import "WeatherPanels"; | |
@font-face { | |
font-family: MajorMonoDisplay; | |
src: url("../assets/Fonts/MajorMonoDisplay-Regular.ttf"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {Component} from 'react'; | |
import './Stylesheets/App.scss'; | |
import Container from "./Components/Container"; | |
class App extends Component { | |
render() { | |
return ( | |
<div className="App"> | |
<Container/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {Component} from "react"; | |
import WeatherForm from "./WeatherForm"; | |
import WeatherPanels from "./WeatherPanels"; | |
class Container extends Component { | |
state = { | |
weatherData: '' | |
}; | |
render() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "mern-weather-app", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"start": "node server/server.js", | |
"server": "nodemon server/server.js", | |
"client": "cd client && npm run start", | |
"dev": "concurrently --kill-others-on-fail \"npm run server\" \"npm run client\"" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "client", | |
"version": "0.1.0", | |
"private": true, | |
"dependencies": { | |
"@testing-library/jest-dom": "^4.2.4", | |
"@testing-library/react": "^9.5.0", | |
"@testing-library/user-event": "^7.2.1", | |
"axios": "^0.19.2", | |
"bootstrap": "^4.5.0", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// other imports | |
import axios from 'axios'; | |
class WeatherForm extends Component { | |
// default state values | |
componentDidMount() { | |
this.refreshSavedWeather(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const saveZipCode = (zipCode) => { | |
return { | |
type: "SAVE_ZIP", | |
payload: zipCode | |
} | |
} | |
export const saveWeatherData = (data) => { | |
return { | |
type: "SAVE_WEATHER_DATA", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get initial state from the previously saved data in local storage | |
let getHistoryFromLocal = () => { | |
let value = localStorage.getItem('WeatherHistory') | |
return JSON.parse(value) || []; | |
} | |
// Maintain a history list of queried weather data of 10 | |
let getUpdatedHistory = (history, value) => { | |
let updateList = [...history]; | |
if (updateList.length >= 10) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// other imports | |
... | |
// Adding redux and reducers | |
import { createStore } from 'redux' | |
import { Provider } from 'react-redux' | |
import rootReducer from './reducers' | |
// Creates our store to use our reducers and the chrome extension to debug the redux store | |
const store = createStore( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// imports | |
import {connect} from "react-redux"; | |
import {saveZipCode, saveWeatherData, saveTemperature, updateHistory} from "../actions"; | |
class WeatherForm extends Component { | |
// default state values | |
// componentDidMount() | |
refreshSavedWeather = () => { | |
if (localStorage.getItem("zipCode")) { |