Skip to content

Commit 4237d29

Browse files
committed
Add comments + delete spaces
1 parent 53bb794 commit 4237d29

File tree

11 files changed

+59
-38
lines changed

11 files changed

+59
-38
lines changed

index.html

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,9 @@ <h1 class="d-flex flex-column align-items-center font-monospace text-uppercase t
123123
type="search"
124124
class="form-control w-90 mx-auto rounded-0 opacity-50 bg-white"
125125
aria-label="Filtrer par ingrégrient">
126-
<button type="button" class="btn-close d-none position-absolute bottom-50 end-20 badge opacity-50" aria-label="Supprimer cet ingrédient">
127-
</button>
128-
<span class="fa-solid fa-magnifying-glass text-black-50 position-absolute bottom-50 end-10 z-1 bg-white" aria-hidden="true"></span>
126+
<button type="button" class="btn-close d-none position-absolute bottom-50 end-20 badge opacity-50" aria-label="Supprimer cet ingrédient">
127+
</button>
128+
<span class="fa-solid fa-magnifying-glass text-black-50 position-absolute bottom-50 end-10 z-1 bg-white" aria-hidden="true"></span>
129129
</li>
130130
</ul>
131131
</div>
@@ -161,9 +161,9 @@ <h1 class="d-flex flex-column align-items-center font-monospace text-uppercase t
161161
type="search"
162162
class="form-control w-90 mx-auto rounded-0 opacity-50 bg-white"
163163
aria-label="Filtrer par appareil">
164-
<button type="button" class="btn-close d-none position-absolute bottom-50 end-20 badge opacity-50" aria-label="Supprimer cet appareil">
165-
</button>
166-
<span class="fa-solid fa-magnifying-glass text-black-50 position-absolute bottom-50 end-10 z-1 bg-white" aria-hidden="true"></span>
164+
<button type="button" class="btn-close d-none position-absolute bottom-50 end-20 badge opacity-50" aria-label="Supprimer cet appareil">
165+
</button>
166+
<span class="fa-solid fa-magnifying-glass text-black-50 position-absolute bottom-50 end-10 z-1 bg-white" aria-hidden="true"></span>
167167
</li>
168168
</ul>
169169
</div>
@@ -199,9 +199,9 @@ <h1 class="d-flex flex-column align-items-center font-monospace text-uppercase t
199199
type="search"
200200
class="form-control w-90 mx-auto rounded-0 opacity-50 bg-white"
201201
aria-label="Filtrer par ustensile">
202-
<button type="button" class="btn-close d-none position-absolute bottom-50 end-20 badge opacity-50" aria-label="Supprimer cet ustensile">
203-
</button>
204-
<span class="fa-solid fa-magnifying-glass text-black-50 position-absolute bottom-50 end-10 z-1 bg-white" aria-hidden="true"></span>
202+
<button type="button" class="btn-close d-none position-absolute bottom-50 end-20 badge opacity-50" aria-label="Supprimer cet ustensile">
203+
</button>
204+
<span class="fa-solid fa-magnifying-glass text-black-50 position-absolute bottom-50 end-10 z-1 bg-white" aria-hidden="true"></span>
205205
</li>
206206
</ul>
207207
</div>

js/RecipesApp.js

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ class RecipesApp {
3838
this.displayTags();
3939
}
4040

41+
/**
42+
* Displays recipe cards
43+
* and recipe counter
44+
* @see displayRecipeCard
45+
*/
4146
handleRecipeCardsData() {
4247
this.recipesData
4348
.forEach(recipe => {
@@ -48,20 +53,28 @@ class RecipesApp {
4853
this.recipesPage.displayRecipesCounter(this.recipesData);
4954
}
5055

56+
/**
57+
* Displays recipe cards with data
58+
* @param {Object} data from array
59+
*/
5160
displayRecipeCard(data) {
5261

5362
const recipeCard = new RecipeCard(data);
5463
const card = recipeCard.createRecipeCard();
5564
this.recipesPage.displayRecipeCard(card);
5665
}
5766

67+
/**
68+
* Checks if user input is valid
69+
* from main search bar
70+
*/
5871
isUserInputValidOnMainSearchBar() {
5972
const mainSearchBar = new MainSearchBar();
6073

6174
this.$userMainInput.addEventListener('input', (e) => {
6275

6376
const userInputValue = e.target.value;
64-
77+
6578
mainSearchBar.inputValidation(userInputValue);
6679
});
6780
}
@@ -72,16 +85,20 @@ class RecipesApp {
7285
displayDropDownListOnSearchFilters() {
7386
this.dropdownList.displaySelectBoxesWithData(this.recipesData);
7487
}
75-
76-
isUserInputValidOnAdvancedFilter() {
88+
89+
/**
90+
* Checks if user input is valid
91+
* from filter search bars
92+
*/
93+
isUserInputValidOnAdvancedFilter() {
7794
const advancedFilterSearchBar = new AdvancedFilterSearchBar();
7895

7996
this.$searchFilterInputs.forEach(input => {
8097

8198
input.addEventListener('input', (e) => {
8299

83100
const userInputValue = e.target.value;
84-
101+
85102
advancedFilterSearchBar.IsUserInputValid(userInputValue, input);
86103
});
87104
});
@@ -100,6 +117,10 @@ class RecipesApp {
100117
});
101118
}
102119

120+
/**
121+
* Items for tag templates
122+
* @see displayActiveTags
123+
*/
103124
displayTags() {
104125
this.tags.push('item 1', 'item 2', 'item 3');
105126
const tags = this.tags;

js/components/AdvancedFilterSearchBar.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class AdvancedFilterSearchBar {
2525

2626
this.$closeBtn.forEach(btn => {
2727
btn.addEventListener('click', (e) => {
28-
28+
2929
this.closeBtn(btn);
3030
this.removeUserInputValue(e.target);
3131

@@ -49,13 +49,13 @@ class AdvancedFilterSearchBar {
4949
if (dropdownHeader.getAttribute('aria-expanded') === 'true') {
5050

5151
icon.classList.replace('fa-chevron-down', 'fa-chevron-up');
52-
52+
5353
} else {
5454
icon.classList.replace('fa-chevron-up', 'fa-chevron-down');
5555
}
5656

5757
}, false);
58-
});
58+
});
5959
}
6060

6161
/**
@@ -87,7 +87,7 @@ class AdvancedFilterSearchBar {
8787
if (inputValue) {
8888
this.launchBtn(btn);
8989
}
90-
90+
9191
currentInput.dataset.validInput = 'true';
9292
}
9393

@@ -116,7 +116,7 @@ class AdvancedFilterSearchBar {
116116
*/
117117
removeUserInputValue(eventTarget) {
118118
const dropdownMenu = eventTarget.closest('.dropdown-menu');
119-
119+
120120
dropdownMenu.querySelector('input').value = '';
121121
}
122122
}

js/components/DropdownList.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
class DropdownList {
88

9-
constructor() {
9+
constructor() {
1010
this.recipesPage = new RecipesPage();
11-
11+
1212
//DOM
1313
this.$ingredientsCustomSelect = document.querySelector('#ingredients_list');
1414
this.$appliancesCustomSelect = document.querySelector('#appliances_list');

js/components/MainSearchBar.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class MainSearchBar {
1010
this.$form = document.querySelector('#main_search');
1111
this.$input = document.querySelector('#recipes_search');
1212
this.$closeBtn = document.querySelector('#main_search .btn-close');
13-
this.$errorMessage = document.querySelector(".error-message");
13+
this.$errorMessage = document.querySelector('.error-message');
1414

1515
// Regular expression
1616
this.inputRules = new RegExp(/^[\w+|\s]{3,30}$/, 'gmi');
@@ -35,7 +35,7 @@ class MainSearchBar {
3535
this.isCharacterErrorMessage();
3636
});
3737

38-
this.$form.querySelector('button').addEventListener("click", () => {
38+
this.$form.querySelector('button').addEventListener('click', () => {
3939
this.closeBtn();
4040
this.removeInputValue();
4141
}, false);
@@ -119,7 +119,7 @@ class MainSearchBar {
119119
if (this.$closeBtn.classList.contains('d-inline-block')) {
120120
this.closeBtn();
121121
}
122-
122+
123123
this.errorMessage('');
124124

125125
if (this.$errorMessage.classList.contains('bg-secondary')) {

js/factories/RecipeFactories.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* ------------------------------------------------------------
55
*/
66

7-
class RecipeFactories {
7+
class RecipeFactories {
88
/**
99
* Returns a new Recipe with recipe properties
1010
* @param {Object} data

js/pages/RecipesPage.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* ------------------------------------------------------------
55
*/
66

7-
class RecipesPage {
7+
class RecipesPage {
88
constructor() {
99
this.$recipeCards = document.querySelector('.recipe-cards');
1010
this.$activeTags = document.querySelector('#active_tags');
@@ -58,4 +58,4 @@
5858
const recipesCounter = new RecipesCounter(cards);
5959
recipesCounter.addNumberOfRecipes();
6060
}
61-
}
61+
}

js/templates/ActiveTag.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ class ActiveTag {
2929
li.innerHTML = `
3030
${item}
3131
<button
32-
type="button"
33-
class="btn-close"
34-
aria-label="Supprimer cet ingrédient">
32+
type='button'
33+
class='btn-close'
34+
aria-label='Supprimer cet ingrédient'>
3535
</button>`;
3636

3737
return li;

js/templates/ItemDropdown.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class ItemDropdown {
2929
if (data !== undefined) {
3030

3131
li.innerHTML = `
32-
<a class="dropdown-item" role="option">
32+
<a class='dropdown-item' role='option'>
3333
${data}
3434
</a>`;
3535
}

js/templates/RecipeCard.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* ------------------------------------------------------------
55
*/
66

7-
class RecipeCard {
7+
class RecipeCard {
88
/**
99
* @param {Object} recipes - list of objects from .json file
1010
*/
@@ -73,7 +73,7 @@
7373
let content = ingredient.ingredient;
7474
let quantity = ingredient.quantity;
7575
let unit = ingredient.unit;
76-
76+
7777
const all = `
7878
<div class="w-50">
7979
<p class="mb-0_1">
@@ -83,7 +83,7 @@
8383
${quantity}${unit}
8484
</p>
8585
</div>`;
86-
86+
8787
const ingredientAndQuantity = `
8888
<div class="w-50">
8989
<p class="mb-0_1">
@@ -93,7 +93,7 @@
9393
${quantity}
9494
</p>
9595
</div>`;
96-
96+
9797
const ingredientOnly = `
9898
<div class="w-50">
9999
<p class="mb-0_1">
@@ -109,9 +109,9 @@
109109
}
110110
} else {
111111
return ingredientOnly;
112-
}
112+
}
113113
}).join(' ');
114114

115115
return ingredientsDom;
116-
}
116+
}
117117
}

0 commit comments

Comments
 (0)