Skip to content

Commit 92346b1

Browse files
committed
refactor: format code with prettier
1 parent f0d5f2b commit 92346b1

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

projects/project_01_browser/js/recipes.js

+13-12
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
let recipes = {};
22

33
const toggleRecipe = (e) => {
4-
const drinkName = e.target.textContent.trim();
5-
const recipeDiv = e.currentTarget.querySelector('.recipe');
6-
7-
if (!recipeDiv) {
8-
const newRecipeDiv = document.createElement('div');
9-
newRecipeDiv.className = 'recipe';
10-
newRecipeDiv.textContent = recipes[drinkName] || 'Recipe not available..';
11-
e.currentTarget.appendChild(newRecipeDiv);
12-
} else {
13-
recipeDiv.style.display = recipeDiv.style.display === 'none' ? 'block' : 'none';
14-
}
15-
};
4+
const drinkName = e.target.textContent.trim();
5+
const recipeDiv = e.currentTarget.querySelector('.recipe');
6+
7+
if (!recipeDiv) {
8+
const newRecipeDiv = document.createElement('div');
9+
newRecipeDiv.className = 'recipe';
10+
newRecipeDiv.textContent = recipes[drinkName] || 'Recipe not available..';
11+
e.currentTarget.appendChild(newRecipeDiv);
12+
} else {
13+
recipeDiv.style.display =
14+
recipeDiv.style.display === 'none' ? 'block' : 'none';
15+
}
16+
};
1617

1718
const initializeApp = () => {
1819
const li = document.querySelectorAll('.drink-list ul li');
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"Mojito": "1/2 lime, 2 teaspoons of brown sugar, 10 mint leaves, 50 ml of white rum, 25 ml of carbonated water. Wash the lime thoroughly and cut it into half-moons. Place in a tall glass and add sugar. Crush with a masher to squeeze the lime juice. Knead the mint leaves slightly in your hands and add them to the glass. Add crushed ice to half the height of the glass. Add rum and mix. Fill with crushed ice and a splash of sparkling water.",
3-
"Margarita": "Recipe for a classic Margarita: tequila (50 ml), triple sec liqueur (20 ml), and lime juice 15 ml.",
4-
"Cosmopolitan": "Pour all the ingredients into a bartender's shaker or an ordinary, small jar: 40 ml of lemon or lime vodka; 20 ml of Cointreau or Triple Sec liqueur; 20 ml of cranberry juice; 10 ml of freshly squeezed lime or lemon juice. Immediately add ice cubes (you can use those from a glass).",
5-
"Piña Colada": "Pour Malibu rum, coconut milk and pineapple juice into a blender. Add a piece of fresh pineapple - only the flesh cut from 1 slice (without the skin and hard center). Mix thoroughly, add crushed ice and mix again. Pour into cups."
6-
}
2+
"Mojito": "1/2 lime, 2 teaspoons of brown sugar, 10 mint leaves, 50 ml of white rum, 25 ml of carbonated water. Wash the lime thoroughly and cut it into half-moons. Place in a tall glass and add sugar. Crush with a masher to squeeze the lime juice. Knead the mint leaves slightly in your hands and add them to the glass. Add crushed ice to half the height of the glass. Add rum and mix. Fill with crushed ice and a splash of sparkling water.",
3+
"Margarita": "Recipe for a classic Margarita: tequila (50 ml), triple sec liqueur (20 ml), and lime juice 15 ml.",
4+
"Cosmopolitan": "Pour all the ingredients into a bartender's shaker or an ordinary, small jar: 40 ml of lemon or lime vodka; 20 ml of Cointreau or Triple Sec liqueur; 20 ml of cranberry juice; 10 ml of freshly squeezed lime or lemon juice. Immediately add ice cubes (you can use those from a glass).",
5+
"Piña Colada": "Pour Malibu rum, coconut milk and pineapple juice into a blender. Add a piece of fresh pineapple - only the flesh cut from 1 slice (without the skin and hard center). Mix thoroughly, add crushed ice and mix again. Pour into cups."
6+
}

0 commit comments

Comments
 (0)