Archived
0
0
Fork 0
This commit is contained in:
Daryl Ronningen 2021-10-07 13:28:39 -07:00
commit 782db8680b
Signed by: Daryl Ronningen
GPG key ID: FD23F0C934A5EC6B
4 changed files with 113 additions and 0 deletions

63
Day 1/index.html Normal file
View file

@ -0,0 +1,63 @@
<!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">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-uWxY/CJNBR+1zjPWmfnSnVxwRheevXITnMqoEIeG1LJrdI0GlVs/9cVSyPYXdcSF" crossorigin="anonymous">
<link rel="stylesheet" href="styles.css">
<title>Random Meal Generator</title>
</head>
<body>
<div class="container-fluid">
<h3 id="meal"></h3>
<div id="border">
<div class="row">
<div class="col">
<img src="" alt="Recipe image" width="300" height="300" id="thumbnail">
<br />
<br />
<br />
<ul>
<li>
<p id="category"></p>
</li>
<li>
<p id="location"></p>
</li>
<li>
<p id="source"></p>
</li>
<li>
<p id="yt"></p>
</li>
</ul>
</div>
<div class="col">
<h5>Ingredients:</h5>
<div id="ingredientsDiv">
<ul id="ingredientsList"></ul>
</div>
<br />
<h5>Instructions:</h5>
<p id="instructions"></p>
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-kQtW33rZJAHjgefvhyyzcGF3C5TFyBQBA13V1RKPf4uH+bwyzQxZ6CmMZHmNBEfJ" crossorigin="anonymous"></script>
<script src="index.js"></script>
</body>
</html>

24
Day 1/index.js Normal file
View file

@ -0,0 +1,24 @@
(async () => {
const recipe = (await (await fetch("https://www.themealdb.com/api/json/v1/1/random.php")).json()).meals[0];
document.getElementById("thumbnail").src = recipe.strMealThumb;
document.getElementById("category").innerText = `Category: ${recipe.strCategory}`;
document.getElementById("location").innerText = `Area: ${recipe.strArea}`;
document.getElementById("meal").innerText = `Meal: ${recipe.strMeal}`;
document.getElementById("source").innerHTML = `Source: <a href="${recipe.strSource}">${recipe.strSource}</a>`;
document.getElementById("yt").innerHTML = `YouTube Tutorial: <a href="${recipe.strYoutube}">${recipe.strYoutube}</a>`;
document.getElementById("instructions").innerText = recipe.strInstructions;
const ingredientsList = document.getElementById("ingredientsList");
for (let index = 0; index < 20; index++) {
const element = recipe[`strIngredient${index + 1}`];
if (element === '') break;
const li = document.createElement('li');
recipe[`strMeasure${index + 1}`] === '' ? li.innerHTML = `<p>${element}</p>` : li.innerHTML = `<p>${element}, ${recipe[`strMeasure${index + 1}`]}</p>`;
ingredientsList.appendChild(li);
}
})();

19
Day 1/styles.css Normal file
View file

@ -0,0 +1,19 @@
#meal {
width: 100%;
text-align: center;
}
#border {
border: 3px solid black;
padding: 10px;
}
#instructions {
border: 1px solid grey;
padding: 7px;
}
#ingredientsDiv {
border: 1px solid grey;
padding: 7px;
}

7
README.md Normal file
View file

@ -0,0 +1,7 @@
# Part of the #100daysofcode Project
But since I suck with coming up with ideas, all code ideas is from <https://www.florin-pop.com/blog/2019/09/100-days-100-projects/> but with my own code.
| Day | Project | Link |
| --- | --- | --- |
| 001 | Random Meal Generator | [link](https://codepen.io/relms12345/full/JjyPYvX)