File tree Expand file tree Collapse file tree 4 files changed +16
-8
lines changed Expand file tree Collapse file tree 4 files changed +16
-8
lines changed Original file line number Diff line number Diff line change 21
21
< p > Ready Meals</ p >
22
22
</ div >
23
23
< div class ="nav-buttons ">
24
- < a href ="index.html " class ="nav-button "> Home</ a >
24
+ < a href ="index.html " class ="nav-button "
25
+ > Meals(< span id ="meal-counter "> </ span > )</ a
26
+ >
25
27
< a href ="#Planets " class ="nav-button "> Planets</ a >
26
28
< a href ="#Races " class ="nav-button "> Races</ a >
27
29
</ div >
Original file line number Diff line number Diff line change 1
1
import './style/style.css' ;
2
2
3
3
import API from './modules/data' ;
4
+ import counter from './modules/counter' ;
4
5
import render from './modules/render/meals' ;
5
6
7
+ const mealCounter = document . getElementById ( 'meal-counter' ) ;
8
+
6
9
const endpoint = 'https://www.themealdb.com/api/json/v1/1/' ;
7
10
const likesEndpoint = 'https://us-central1-involvement-api.cloudfunctions.net/capstoneApi/apps/lvQFdeSbvijlsDX1Y4VY/likes/' ;
8
11
@@ -12,7 +15,9 @@ const displayMeals = () => {
12
15
API . getLikes ( likesEndpoint ) ,
13
16
] ) . then ( ( data ) => {
14
17
render ( data [ 0 ] , data [ 1 ] ) ;
18
+ const length = counter . meals ( data [ 0 ] . meals ) ;
19
+ mealCounter . innerText = length ;
15
20
} ) ;
16
21
} ;
17
22
18
- window . addEventListener ( 'load' , displayMeals ) ;
23
+ window . addEventListener ( 'load' , displayMeals ) ;
Original file line number Diff line number Diff line change
1
+ const counter = {
2
+ meals : ( allMeals ) => allMeals . length ,
3
+ comments : ( allComments ) => allComments . length ,
4
+ reservation : ( allReservations ) => allReservations . length ,
5
+ } ;
6
+
7
+ export default counter ;
Original file line number Diff line number Diff line change @@ -201,7 +201,6 @@ footer {
201
201
border-radius : 1em ;
202
202
box-shadow : rgba (100 , 100 , 111 , 0.5 ) 0 10px 20px 0 ;
203
203
justify-content : center;
204
- text-align : center;
205
204
}
206
205
207
206
.modal-header {
@@ -212,7 +211,6 @@ footer {
212
211
.modal-details {
213
212
display : flex;
214
213
gap : 2em ;
215
- flex-direction : column;
216
214
}
217
215
218
216
.modal-img {
@@ -343,14 +341,11 @@ input {
343
341
}
344
342
345
343
.comment-form {
346
- margin : auto;
347
344
font-family : 'Space Grotesk' , sans-serif;
348
345
margin-top : 2em ;
349
346
display : flex;
350
347
flex-direction : column;
351
348
gap : 1em ;
352
- width : 70% ;
353
- text-align : center;
354
349
}
355
350
356
351
.no-comments {
@@ -364,7 +359,6 @@ input {
364
359
display : flex;
365
360
flex-direction : column;
366
361
gap : 1em ;
367
- align-items : center;
368
362
width : 100% ;
369
363
}
370
364
You can’t perform that action at this time.
0 commit comments