JSFiddle - React, Tailwind, and code Playground

HTML

<!DOCTYPE html>
<html lang="en">

  <head>

    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Weather App</title>

    <link rel="stylesheet" href="style.css">
    <link href="https://fonts.googleapis.com/css2?family=Rubik:wght@300;400&display=swap" rel="stylesheet">
  </head>

  <body>

    <h2>no matter the weather, always bring your own sunshine.</h2>

    <div class="divSearch">

      <!-- Search bar input and Icon  -->
      <div class="divSearchBar">

        <input type="text" name="" id="searchBar" placeholder="Check weather in...">
        <button id="searchIcon"><svg stroke="whitesmoke" fill="whitesmoke" stroke-width="1.5" viewBox="0 0 26 24" height="1.2em" width="1.2em" style="background-color:rgb(71, 71, 63)" xmlns="http://www.w3.org/2000/svg">
            <path d="M19.023,16.977c-0.513-0.488-1.004-0.997-1.367-1.384c-0.372-0.378-0.596-0.653-0.596-0.653l-2.8-1.337 C15.34,12.37,16,10.763,16,9c0-3.859-3.14-7-7-7S2,5.141,2,9s3.14,7,7,7c1.763,0,3.37-0.66,4.603-1.739l1.337,2.8 c0,0,0.275,0.224,0.653,0.596c0.387,0.363,0.896,0.854,1.384,1.367c0.494,0.506,0.988,1.012,1.358,1.392 c0.362,0.388,0.604,0.646,0.604,0.646l2.121-2.121c0,0-0.258-0.242-0.646-0.604C20.035,17.965,19.529,17.471,19.023,16.977z M9,14 c-2.757,0-5-2.243-5-5s2.243-5,5-5s5,2.243,5,5S11.757,14,9,14z"></path>
          </svg></button>
      </div>

      <div class="recentlySearched">

        <p class="recentCity"> </p>
        <p class="recentCity"> </p>
        <p class="recentCity"> </p>

      </div>

    </div>

    <div class="containerStats" class="hidden">

      <p id="bigPadding">Look up a city for it's weather stats.</p>

      <div id="divTemperature" class="hidden">

        <p id="temperature">19°</p>
        <p id="metricCelcius">C</p>

      </div>

      <div class="hidden">

        <p id="city">Rosario</p>

        <div id="iconText">

          <p...

CSS

* {

  font-family: 'Rubik', sans-serif;
  transition: 0.5s;
}

body {

  background-image: url(img/rosario.jpg);

  overflow: hidden;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
  background-color: rgb(41, 35, 35);
  position: relative;
  display: flex;
  height: 99vh;
  width: 98vw;

}

h2 {
  color: rgb(37, 34, 34);

}

p {

  color: whitesmoke;
  font-size: 32px;
  font-weight: 300;
  margin: 0;
}

#iconText img {

  width: 40px;
  height: 40px;
  margin-left: 10px;
}

#iconText {

  display: flex;

}

.divSearch {

  position: absolute;
  top: 0;
  right: 0;
  background-color: rgba(87, 86, 83, 0.664);
  padding: 22px;

  width: max-content;
  border-radius: 12px;
  backdrop-filter: blur(12px);
  margin: 20px;
}

#searchBar {

  width: 260px;
  height: 42px;
  margin-right: 10px;
  border-style: none;
  border-bottom: 1px solid whitesmoke;
  font-size: 20px;
  border-radius: 5px;
}

#searchIcon {

  width: 48px;
  height: 48px;
  background-color: rgb(71, 71, 63);
  border-radius: 10px;



}

.recentCity {

  font-size: 26px;
  font-weight: 300;
  margin: 12px;

  opacity: 0;
  transition: 1s;

}

.recentCity:hover {

  transition: 0.5s;
  font-size: 30px;
  cursor: pointer;

}


.containerStats {

  display: flex;
  position: absolute;
  bottom: 22px;
  margin: 20px;
  margin-left: 28px;
  padding: 10px;
  text-align: left;
  align-items: center;
  justify-content: space-around;
  background-color: rgba(34, 32, 32, 0.253);
  backdrop-filter: blur(12px);
  border-radius: 10px;


}

#divTemperature {

  display: flex;
  vertical-align: baseline;
}

#temperature {

  font-size: 82px;
  vertical-align: bottom;
}

#metricCelcius {

  font-size: 62px;
  font-weight: 300;
  margin-right: 22px;
  vertical-align: center;
}


#spaceBetween {

  display: flex;
  justify-content: space-between;
  margin-left: 2vw;
}

#windSpeedKM {

  margin-left: 4vw;
}

#humidityPorcentage {

  margin-left: 4vw;
}

.hidden {

  display:...

JavaScript

//Var declarations for search bar.
let inputCity = document.getElementById("searchBar");
let cityName = inputCity.value;
let searchIcon = document.getElementById("searchIcon");
let recentCitySearches = document.querySelectorAll("p.recentCity");

//Var declarations for stats output.
let temperatureOutput = document.getElementById("temperature");
let cityOutput = document.getElementById("city");
let iconOutput = document.getElementById("weatherIcon");
let adjectiveOutput = document.getElementById("weatherText");
let windOutput = document.getElementById("windSpeedKM");
let humidityOutput = document.getElementById("humidityPorcentage");


//API link-creation vars
let api_url = "https://api.openweathermap.org/data/2.5/weather?q=";
let api_key = "&appid=8d6d613f6cb4621a5c237a580219c44c";
let unit = "&units=metric";


let i = 0;
let start = true;
let finishedStatsChange = true;


//Send input to by pressing enter.
inputCity.addEventListener("keydown", enter => {

  if (enter.key == "Enter") {

    //Change city name variable, and call function for upper case.
    cityName = inputCity.value;
    let latestSearch = firstUpperCase(cityName);

    //Update history to show the city name.
    recentCitySearches[i].style.opacity = 0;
    recentCitySearches[i].innerHTML = latestSearch;
    recentCitySearches[i].style.opacity = 1;

    //Clean input text.
    inputCity.value = "";
    cityName = latestSearch;
    i++;

    //Finish api url by adding the city name from input, call getData() function-
    let full_url = api_url + cityName + unit + api_key;
    getData(full_url);

    if (i > 2) {

      i = 0;


    }
  }

})

//Send input to by clicking search icon instead of pressing enter.
searchIcon.addEventListener("click", search => {


  //Change city name variable, and call function for upper case.
  cityName = inputCity.value;
  let latestSearch = firstUpperCase(cityName);

  //Update history to show the city name.

  recentCitySearches[i].style.opacity = 0;
 ...