mirror of
https://github.com/cse110-fa22-group29/cse110-fa22-group29.git
synced 2025-09-10 08:27:20 +00:00
review page functionality
This commit is contained in:
@@ -124,6 +124,24 @@ class ReviewCard extends HTMLElement {
|
||||
mealLabel.setAttribute('class','meal-name');
|
||||
mealLabel.innerHTML = data['mealName'];
|
||||
|
||||
//review page link
|
||||
//giving it functionality to save the review card's info to session storage for loading the review page
|
||||
let reviewLink = document.createElement('a');
|
||||
reviewLink.setAttribute('href','./review.html')
|
||||
reviewLink.innerHTML = 'review page'
|
||||
reviewLink.addEventListener('click', () => {
|
||||
sessionStorage.clear();
|
||||
let currReview = {
|
||||
"imgSrc": data['imgSrc'],
|
||||
"imgAlt": data['imgAlt'],
|
||||
"mealName": data['mealName'],
|
||||
"restaurant": data['restaurant'],
|
||||
"rating": data['rating'],
|
||||
"tags": data['tags']
|
||||
}
|
||||
sessionStorage.setItem('currReview', JSON.stringify(currReview));
|
||||
});
|
||||
|
||||
let restaurantLabel = document.createElement('label');
|
||||
restaurantLabel.setAttribute('class','restaurant-name');
|
||||
restaurantLabel.innerHTML = data['restaurant'];
|
||||
@@ -148,6 +166,7 @@ class ReviewCard extends HTMLElement {
|
||||
|
||||
articleEl.append(mealImg);
|
||||
articleEl.append(mealLabel);
|
||||
articleEl.append(reviewLink)
|
||||
articleEl.append(restaurantLabel);
|
||||
articleEl.append(ratingDiv);
|
||||
articleEl.append(tagContainer);
|
||||
|
Reference in New Issue
Block a user