diff --git a/zip-search/src/App.css b/zip-search/src/App.css index e90e8d7..3aad493 100644 --- a/zip-search/src/App.css +++ b/zip-search/src/App.css @@ -1,6 +1,47 @@ .App-header { - background-color: #222; + background-color: #6457A6; padding: 20px; color: white; text-align: center; } + +.App-Search{ + text-align: center; + padding-top: 1em; +} + +.Round-Search{ + border-radius: 15px; + background-color:#9dacff79; + border-color: transparent; + outline: none; +} + +.info-header{ + font-weight: bold; + width:100%; + padding-top: 0.5em; + text-align: center; +} + +.App-Info-Container{ + list-style-position: inside; + display: flex; + justify-content: center; + padding:1em; +} + +.Spacious{ + padding-top: 10px; +} +.content{ + padding:0.5em; + text-align: left; + padding-right: 3em; +} + +.cities{ + text-align: left; + border-radius: 10px; + box-shadow: 0 0px 2px 0 rgba(0, 0, 0, 0.274); +} diff --git a/zip-search/src/App.js b/zip-search/src/App.js index 91e9361..ee91cc2 100644 --- a/zip-search/src/App.js +++ b/zip-search/src/App.js @@ -3,25 +3,90 @@ import './App.css'; function City(props) { - return (
This is the City component
); + return ( +
+
+
+
{props.locationText}
+
+
    +
  • State: {props.stateName}
  • +
  • Location: {props.location}
  • +
  • Population (estimated): {props.population}
  • +
  • Total Wages: {props.wages}
  • +
+
+
+
); } function ZipSearchField(props) { - return (
This is the ZipSearchField component
); + + return ( +
+ Zip Code: + +
); + } class App extends Component { + + constructor(props) { + super(props) + + this.state = { + zipCode: "", + cities: [], + }; + + } + saveCities = (cities) => { + this.setState({cities}) + } + + zipSearchCheck = (event) => { + + this.setState( {zipCode: event.target.value} ) + + if(event.target.value.length == 5) { + fetch("http://ctp-zip-api.herokuapp.com/zip/" + event.target.value) + .then((response) => response.json()) + .then(this.saveCities) + } + else { + this.saveCities([]); + } + + } + + render() { return ( +

Zip Code Search

- -
- - +
+ +
Current Zip is {this.state.zipCode}
+
+ + +
+ +
+ { this.state.cities.map((city) => + ) } +
);