diff --git a/07week/brew.css b/07week/brew.css new file mode 100644 index 000000000..84aed0a88 --- /dev/null +++ b/07week/brew.css @@ -0,0 +1,34 @@ +body, +#result { + padding: 50px; +} + +h2 { + margin: 15px 401px -100px; + padding: 12px +} + +ol li { + padding-bottom: 5px; +} + + + +input[type="text"] { + width: 350px; + margin: 150px 200px; + padding: 12px; + border: 1px solid #ccc; + border-radius: 4px; + resize: vertical; +} + +button { + background-color: #4caf50; + color: white; + margin: -186px ; + padding: 12px 20px; + border: none; + border-radius: 4px; + cursor: pointer; +} \ No newline at end of file diff --git a/07week/brew.html b/07week/brew.html new file mode 100644 index 000000000..40a62b2c4 --- /dev/null +++ b/07week/brew.html @@ -0,0 +1,17 @@ + + + + + + + + + +

Beer choice!

+
+ + +
+
+ + diff --git a/07week/brew.js b/07week/brew.js new file mode 100644 index 000000000..6360a153f --- /dev/null +++ b/07week/brew.js @@ -0,0 +1,39 @@ +var getSearchText; + +function keyup(searchText) { + //setting your input text to the global Javascript Variable for every key press + console.log(searchText) + return getSearchText = searchText; + + //listens for you to press the ENTER key, at which point your web address will change to the one you have input in the search box + // if (e.keyCode == 13) { + // window.location = "http://www.myurl.com/search/" + inputTextValue; + // } +} + + +function getBrew() { + // const proxy = "https://cors-anywhere.herokuapp.com/"; + // const enterTxt = + const api = `http://api.punkapi.com/v2/beers?beer_name=${getSearchText}` + fetch(api) + .then(function(response) { + return response.json() + console.log(response) + }) + .then(function(result) { + console.log('result', result) + let output = + `

` + result.forEach((function(brew){ + output += ` + + ` + })) + document.getElementById("demo").innerHTML = output; + }) +}