Skip to content
Open

done #283

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ I completed the challenge: 5
I feel good about my code: 4
I'm not sure if my constructors are setup cleanly...
```
<img width="820" height="499" alt="Screenshot 2025-10-07 at 2 27 47 PM" src="https://github.com/user-attachments/assets/fee77ce4-8c04-460f-9737-16dea3284439" />
35 changes: 35 additions & 0 deletions css/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
*{
box-sizing: border-box;
}

body{
text-align: center;
}

html{
background-image: url(https://t4.ftcdn.net/jpg/14/92/84/71/360_F_1492847175_hefpSJVlFxZfHDmskJ050Q1E37I0pb2C.jpg);
background-repeat: no-repeat;
background-size: cover;
}
h1{
color: rgb(53, 47, 47);
font-size: 2.5rem;
text-align: center;
background: rgba(250, 250, 250, 0.5);
width: 50%;
margin-left: 25%;
}

img{
/* width: 200px;
height: 200px; */
}
#data{
padding-top: 20px;
font-size: 2.0rem;
color: white;
}

#wines{
font-size: 1.5rem;
}
29 changes: 29 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Wine & Cheese Pairing</title>
<link rel="stylesheet" href="css/styles.css">
</head>
<body>
<h1><em>Find Your Wine Vibe</em></h1>
<div= id="container">
<select id="wines" name="wines">
<option value="Merlot">Merlot</option>
<option value="Syrah">Syrah</option>
<option value="Cabernet Sauvignon">Cabernet Sauvignon</option>
<option value="Pinot Noir">Pinot Noir</option>
<option value="Grand Cru">Grand Cru</option>
<option value="Shiraz">Shiraz</option>
</select>
</div>

<div id="data"></div>
<img src="">


<script type="text/javascript" src="js/main.js"></script>
</body>
</html>

41 changes: 41 additions & 0 deletions js/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@

// make a wine page where users can the kind of wine they want
// use a drop down menu



const wines = document.getElementById('wines')
let winedata;
const requestOptions = {
method: "GET",
redirect: "follow"
};

//create a variable to store wine data

fetch("https://api.sampleapis.com/wines/reds", requestOptions)
.then((response) => response.json())
.then((data) => {
console.log(data);
winedata = data
})
.catch((error) => console.error(error));



wines.addEventListener(("change"), () => {
// take the wine data use the find function which determines the first matching result. The match function takes the name of the wine from the data (user's selected wine choice)
const wine = winedata.find(w => w.wine.includes(wines.value))
console.log(wine);
const dataDiv = document.getElementById("data");
dataDiv.innerText = wine.winery
const img = document.querySelector("img");
img.src = wine.image
})



// completed with the help of Fullstack Engineer: Taariq Elliot during DevFest and Michael Kazin