diff --git a/.DS_Store b/.DS_Store
new file mode 100644
index 0000000..473dbb1
Binary files /dev/null and b/.DS_Store differ
diff --git a/city-search b/city-search
new file mode 160000
index 0000000..8ec32ff
--- /dev/null
+++ b/city-search
@@ -0,0 +1 @@
+Subproject commit 8ec32ffed07f2533793d1c98112da3d24d57ac98
diff --git a/zip-search/src/App.css b/zip-search/src/App.css
index e90e8d7..42cbd7a 100644
--- a/zip-search/src/App.css
+++ b/zip-search/src/App.css
@@ -4,3 +4,38 @@
color: white;
text-align: center;
}
+#zip{
+ margin-left: 8px;
+ text-align: center;
+}
+.zip{
+ padding-top: 60px;
+ display: flex;
+ justify-content: center;
+ font-size: 20px;
+ font-weight: 500;
+}
+.city{
+ justify-content: center;
+ margin: 20px;
+ border: 2px solid #f3f3f3;
+ width: 400px;
+}
+.container{
+ width: 400px;
+}
+.city-name{
+ text-align: center;
+ background-color: #888;
+ color: white;
+ padding: 10px
+}
+.results{
+ padding-top: 30px ;
+ display: flex;
+ justify-content: center;
+}
+li{
+ margin: 2px;
+ padding: 5px
+}
\ No newline at end of file
diff --git a/zip-search/src/App.js b/zip-search/src/App.js
index 91e9361..59a6f39 100644
--- a/zip-search/src/App.js
+++ b/zip-search/src/App.js
@@ -3,25 +3,69 @@ import './App.css';
function City(props) {
- return (
This is the City component
);
+ return (
+
+
{props.name}
+
+
+ - State: {props.state}
+ - Location: ({props.lat}, {props.long})
+ - Population: {props.population}
+ - Total Wages: {props.wages}
+
+
+
+ );
}
function ZipSearchField(props) {
- return (This is the ZipSearchField component
);
+ return (
+
+
+
+
+ );
}
-
class App extends Component {
+ state = {
+ cities: [],
+ zip: '',
+ activateFetch: false
+ }
+ updateZip = async (e) => {
+ await this.setState({ zip: e.target.value });
+ if(this.state.zip.length - 1 === 4){
+ this.updateCities();
+ console.log(this.state.cities);
+ } else {
+ this.setState({ cities: [] }); //resets state once character is less than 5
+ }
+ }
+ updateCities = async () => {
+ await fetch(`http://ctp-zip-api.herokuapp.com/zip/${this.state.zip}`)
+ .then( res => res.json())
+ .then( data => this.setState({ cities: data }))
+ .catch( error => console.log(error));
+ }
render() {
return (
Zip Code Search
-
-
-
-
+
+
+ {
+ this.state.cities.length === 0 ?
+
+ :
+
+ {
+ this.state.cities.map(city => )
+ }
+
+ }
);
diff --git a/zip-search/src/index.css b/zip-search/src/index.css
index e69de29..4c2dc71 100644
--- a/zip-search/src/index.css
+++ b/zip-search/src/index.css
@@ -0,0 +1,3 @@
+#none {
+ padding-top: 200px;
+}
\ No newline at end of file