Connor Mills

Connor Mills

1659063683

HTML, CSS & JavaScript Project: Build Cocktail App

In this tutorial, we will learn how to create a cocktail app with HTML, CSS and Javascript.

Create a cocktail app where the user can search a cocktail of choice and the app displays the ingredients and instructions to make the cocktail. We use 'The Cocktail DB' API to fetch information required for our app.

Project Folder Structure:

Before we start coding let us take look at the project folder structure. We create a project folder called – ‘Cocktail App’. Inside this folder, we have three files. These files are index.html, style.css and script.js.

HTML:

We start with the HTML code. First, copy the code below and paste it into your HTML document.

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Cocktail App</title>
    <!-- Google Font -->
    <link
      href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap"
      rel="stylesheet"
    />
    <!-- Stylesheet -->
    <link rel="stylesheet" href="style.css" />
  </head>
  <body>
    <div class="container">
      <div class="search-container">
        <input
          type="text"
          placeholder="Type a cocktail name..."
          id="user-inp"
          value="margarita"
        />
        <button id="search-btn">Search</button>
      </div>
      <div id="result"></div>
    </div>
    <!-- Script -->
    <script src="script.js"></script>
  </body>
</html>

CSS:

Next, we style this app using CSS. For this copy, the code provided to you below and paste it into your stylesheet.

* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
}
body {
  height: 100vh;
  background: linear-gradient(#5372f0 50%, #000000 50%);
}
.container {
  position: absolute;
  transform: translate(-50%, -50%);
  top: 50%;
  left: 50%;
  width: 90vw;
  max-width: 37.5em;
  background-color: #ffffff;
  padding: 1.8em;
  border-radius: 0.6em;
  box-shadow: 0 1em 3em rgba(2, 9, 38, 0.25);
}
.search-container {
  display: grid;
  grid-template-columns: 9fr 3fr;
  gap: 1em;
  margin-bottom: 1.2em;
}
.search-container input {
  font-size: 1em;
  padding: 0.6em 0.3em;
  border: none;
  outline: none;
  color: #1f194c;
  border-bottom: 1.5px solid #1f194c;
}
.search-container input:focus {
  border-color: #5372f0;
}
.search-container button {
  font-size: 1em;
  border-radius: 2em;
  background-color: #5372f0;
  border: none;
  outline: none;
  color: #ffffff;
  cursor: pointer;
}
#result {
  color: #575a7b;
  line-height: 2em;
}
#result img {
  display: block;
  max-width: 12.5em;
  margin: auto;
}
#result h2 {
  font-size: 1.25em;
  margin: 0.8em 0 1.6em 0;
  text-align: center;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: #1f194c;
  position: relative;
}
#result h2:before {
  content: "";
  position: absolute;
  width: 15%;
  height: 3px;
  background-color: #5372f0;
  left: 42.5%;
  bottom: -0.3em;
}
#result h3 {
  font-size: 1.1em;
  font-weight: 600;
  margin-bottom: 0.2em;
  color: #1f194c;
}
#result ul {
  margin-bottom: 1em;
  margin-left: 1.8em;
  display: grid;
  grid-template-columns: auto auto;
}
#result li {
  margin-bottom: 0.3em;
}
#result p {
  text-align: justify;
  font-weight: 400;
  font-size: 0.95em;
}
.msg {
  text-align: center;
}
@media screen and (max-width: 600px) {
  .container {
    font-size: 14px;
  }
}

Javascript:

Lastly, we implement the functionality using Javascript. Now copy the code below and paste it into your script file.

let result = document.getElementById("result");
let searchBtn = document.getElementById("search-btn");
let url = "https://thecocktaildb.com/api/json/v1/1/search.php?s=";
let getInfo = () => {
  let userInp = document.getElementById("user-inp").value;
  if (userInp.length == 0) {
    result.innerHTML = `<h3 class="msg">The input field cannot be empty</h3>`;
  } else {
    fetch(url + userInp)
      .then((response) => response.json())
      .then((data) => {
        document.getElementById("user-inp").value = "";
        console.log(data);
        console.log(data.drinks[0]);
        let myDrink = data.drinks[0];
        console.log(myDrink.strDrink);
        console.log(myDrink.strDrinkThumb);
        console.log(myDrink.strInstructions);
        let count = 1;
        let ingredients = [];
        for (let i in myDrink) {
          let ingredient = "";
          let measure = "";
          if (i.startsWith("strIngredient") && myDrink[i]) {
            ingredient = myDrink[i];
            if (myDrink[`strMeasure` + count]) {
              measure = myDrink[`strMeasure` + count];
            } else {
              measure = "";
            }
            count += 1;
            ingredients.push(`${measure} ${ingredient}`);
          }
        }
        console.log(ingredients);
        result.innerHTML = `
      <img src=${myDrink.strDrinkThumb}>
      <h2>${myDrink.strDrink}</h2>
      <h3>Ingredients:</h3>
      <ul class="ingredients"></ul>
      <h3>Instructions:</h3>
      <p>${myDrink.strInstructions}</p>
      `;
        let ingredientsCon = document.querySelector(".ingredients");
        ingredients.forEach((item) => {
          let listItem = document.createElement("li");
          listItem.innerText = item;
          ingredientsCon.appendChild(listItem);
        });
      })
      .catch(() => {
        result.innerHTML = `<h3 class="msg">Please enter a valid input</h3>`;
      });
  }
};
window.addEventListener("load", getInfo);
searchBtn.addEventListener("click", getInfo);

📁 Download Source Code:  https://www.codingartistweb.com

#html #css #javascript 

Jenny Jabde

1621251999

Quick Flow Male Enhancement Reviews, Benefits Price & Buy Quick Flow?

364bb242-ab45-4601-b9cc-e444f2270076

On the off chance that you fall in the subsequent class, Quick Flow Male Enhancement is the thing that your body is needing right now. The recently discovered male arrangement is the difficult solver for numerous types and types of erectile pressure causing brokenness and causes those issues to be rectified and henceforth blessings you with the more youthful sexual variant.

What is Quick Flow Male Enhancement?
With the new pill, you can supplant all extraordinary and numerous allopathic drugs you had been taking for each issue in an unexpected way. Quick Flow Male Enhancement is the one in all treating instrument pill and causes those explicitly hurtful issues to get right. Regardless of everything, those obstacles are restored and unquestionably, you can feel that the sexual peaks are better. This item builds body imperativeness and the measure of discharge that is required is likewise directed by it.

**How can it really function? **

Different results of this class have numerous regular Ingredients in them, yet the ones here in Quick Flow Male Enhancement are truly uncommon and furthermore natural in their reap and produce. This allows you to get the experience of the truth of more profound sex intercourse which you generally thought was a fantasy for you. Positively, this is a demonstrated natural thing, and relying upon it is no place off-base according to specialists. It is time that your body is given valuable minerals as requested by age.

download-1
**How to Buy? **

It is fundamental that you visit the site and see by your own eyes you willing we are to help you in each progression. Start from the terms and furthermore know inconspicuously the states of procurement. Any question must be addressed as of now or, more than likely later things probably won’t go as you might suspect. Purchase Quick Flow Male Enhancement utilizing any method of online installment and you may likewise go for the simple EMI choice out there.

https://www.benzinga.com/press-releases/21/03/wr20313473/quick-flow-male-enhancement-reviews-fast-flow-male-enhancement-most-effective-and-natural-formul

https://www.facebook.com/Quick-Flow-Male-Enhancement-111452187779423

#quick flow male enhancement #quick flow male enhancement reviews #quick flow male enhancement male health #quick flow male enhancement review #quick flow male enhancement offer #quick flow male enhancement trial

King Size Male Enhancement Pills Reviws

King Size Male Enhancement For instance contains Hawthorn Berry which improves blood stream to King Size Pills the penis yet all through the body fortifying your general circulatory framework wellbeing. With most enhancers you should take possibly a couple of pills for each day; one in the first part of the day and one around evening time.

Click to Order King Size Male Enhancement From The Official Website

King Size Male Enhancement It is significant that you are appropriately hydrated. King Size Pills In the event that you drink water when you take the pill and you are hydrated then you can guarantee it will break down and be consumed by the body rapidly. Most men take them for a while. Why Well roughly 3-4 months is around the time it takes for to accomplish greatest outcomes.

https://kingsizeshop.wixsite.com/king-size-male-enhan
https://sites.google.com/view/king-size-male-enhancement/home
https://publons.com/researcher/4056872/king-size-pills/
https://angel.co/u/king-size-male-enhancement
https://angel.co/company/king-size-male-enhancement-1
https://teespring.com/stores/king-size-pills
https://www.spreaker.com/user/kingsizemaleenhancement
https://www.spreaker.com/show/king-size-male-enhancement-pills-reviws
https://lunaireketobhb.blogspot.com/2020/12/king-size-male-enhancement-king-size.html
https://mrxmaleenhancement-point.blogspot.com/2020/12/king-size-male-enhancement-king-size.html

#king size pills #king size male enhancement #king size male enhancement pills #male enhancement

King Size Male Enhancement Pills Reviws

King Size Male Enhancement For instance contains Hawthorn Berry which improves blood stream to King Size Pills the penis yet all through the body fortifying your general circulatory framework wellbeing. With most enhancers you should take possibly a couple of pills for each day; one in the first part of the day and one around evening time.

King Size Male Enhancement It is significant that you are appropriately hydrated. King Size Pills In the event that you drink water when you take the pill and you are hydrated then you can guarantee it will break down and be consumed by the body rapidly. Most men take them for a while. Why Well roughly 3-4 months is around the time it takes for to accomplish greatest outcomes.

https://kingsizeshop.wixsite.com/king-size-male-enhan
https://sites.google.com/view/king-size-male-enhancement/home
https://publons.com/researcher/4056872/king-size-pills/
https://angel.co/u/king-size-male-enhancement
https://angel.co/company/king-size-male-enhancement-1
https://teespring.com/stores/king-size-pills
https://www.spreaker.com/user/kingsizemaleenhancement
https://www.spreaker.com/show/king-size-male-enhancement-pills-reviws
https://lunaireketobhb.blogspot.com/2020/12/king-size-male-enhancement-king-size.html
https://mrxmaleenhancement-point.blogspot.com/2020/12/king-size-male-enhancement-king-size.html

#king size male enhancement #king size pills #king size male enhancement pills reviws #male enhancement

ElectroHard Male Enhancement [LEGIT]: Men's Health Supplement Pills

http://firsthealth24x7.com/electrohard-male-enhancement/

ElectroHard Male Enhancement

https://www.facebook.com/ElectroHard.Male.Enhancement/

Up until this point, we haven’t seen any notice of ElectroHard Male EnhancementSide Effects. Which is an extraordinary sign that these pills can assist you with accomplishing prime exhibitions with no issues! Truth be told, these pills utilize NATURAL fixings to get you the outcomes you need. Be that as it may, in the event that you have any inquiries or concerns, make certain to talk with your PCP prior to utilizing the enhancement. Something else, click any picture or catch on this page RIGHT NOW to check whether there is a FREE TRIAL OFFER accessible before this unbelievable enhancement sells out! With this staggering offer, you can get a preliminary of this unbelievable offer so you can perceive your opinion prior to focusing on paying the full ElectroHard Male EnhancementCost. However, this offer will not keep going long! Thus, click any picture or catch on this page to guarantee a FREE TRIAL OFFER enhancement before provisions are no more!

By clicking any picture or catch on this page RIGHT NOW, you can get to the least ElectroHard Male EnhancementCost at this point! At this moment, you can guarantee your first enhancement for FREE with a selective preliminary offer. That way, you can see with your own eyes whether you like the outcomes prior to focusing on paying the full ElectroHard Male EnhancementPrice. What’s more, best of all, you can get your first enhancement for the simple expense of postage! With this staggering offer, you can see with your own eyes why such countless men are cherishing their presentation helps. Anyway, would you say you are prepared to get your excellent room exhibitions? Snap any picture or catch on this page to guarantee a FREE TRIAL OFFER of these PRIME exhibition pills before provisions are no more!

https://www.facebook.com/ElectroHard.Male.Enhancement/

https://www.facebook.com/ElectroHard.Official/

https://www.facebook.com/EreXegen/

https://www.facebook.com/VYPrimax/

#electrohard male enhancement #electrohard