From f9ec6aaab9b8ff83a8424d7790f4b96dbb7619d1 Mon Sep 17 00:00:00 2001 From: Gemini Sharma Date: Thu, 13 Jun 2024 12:59:27 +0530 Subject: [PATCH] done --- js/index.js | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/js/index.js b/js/index.js index 4f558c2..607ba0d 100644 --- a/js/index.js +++ b/js/index.js @@ -44,26 +44,72 @@ function renderPepperoni() { function renderMushrooms() { // Iteration 1: set the visibility of `
` + document.querySelectorAll('.mushroom').forEach((oneMushroom) => { + if (state.mushrooms) { + oneMushroom.style.visibility = 'visible'; + } else{ + oneMushroom.style.visibility = 'hidden'; + } + }); } function renderGreenPeppers() { // Iteration 1: set the visibility of `
` + document.querySelectorAll('.green-pepper').forEach((oneGreenPepper) => { + if (state.greenPeppers){ + oneGreenPepper.style.visibility='visible'; + } else{ + oneGreenPepper.style.visibility='hidden'; + } + }); } function renderWhiteSauce() { // Iteration 2: add/remove the class "sauce-white" of `
` + document.querySelectorAll('.sauce').forEach((oneSauce) => { + if (state.whiteSauce) { + oneSauce.classList.add('sauce-white'); + } else { + oneSauce.classList.remove('sauce-white'); + } + }); } function renderGlutenFreeCrust() { // Iteration 2: add/remove the class "crust-gluten-free" of `
` + document.querySelectorAll('.crust').forEach((oneCrust) => { + if (state.glutenFreeCrust) { + oneCrust.classList.add('crust-gluten-free'); + } else { + oneCrust.classList.remove('crust-gluten-free'); + } + }); } function renderButtons() { // Iteration 3: add/remove the class "active" of each `