Skip to content

Commit

Permalink
last commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Mansi523 committed Sep 21, 2023
1 parent a76e9e3 commit 5adbe2f
Show file tree
Hide file tree
Showing 6 changed files with 490 additions and 190 deletions.
24 changes: 9 additions & 15 deletions favourite.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,36 +17,30 @@

<div class="nav-left">
<div class="nav-logo">
<a href="index.html"><i class="fa-solid fa-utensils"></i></a>
<a href="index.html"><i class="fa-solid fa-utensils"></i></a>
<span>Pour Tous</span>
</div>
</div>


<div class="nav-right">

<div class="nav-input-container">
<input id="InputValue" type="text" placeholder="Search for your meal">
<button onclick="handleScearch()"><img
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOEAAADhCAMAAAAJbSJIAAAAdVBMVEX///8AAADc3NzNzc3m5ub39/f6+vqMjIyvr6/T09Ozs7NnZ2eRkZHl5eWsrKzq6uphYWGHh4c/Pz/w8PAgICA0NDSjo6MVFRXJyclqampbW1s8PDwmJiZ3d3dVVVW3t7dKSkoPDw99fX3BwcEtLS2ZmZmXl5ccVvkXAAAEj0lEQVR4nO2ciXaiQBBF0xjADUVU3KPEJP//idMmnCQzIdhAd1U18+4X9D08oRbk4QEAAAAAAAAAAAAAAAAAAAAAAAAAAABgTJKH3EdwTKCKRcJ9CKcESjPZch/DIe+GSh3H3AdxRmmoWTxyn8UNX4Z9Det3Q6XWQ+7z2Odvw1tY59xHsswPQx3WAfehrFJhqFQ261EZUGmodBnQm7D+YqhJexLW3w37EtY6Q6VWPSgD6g01e9/DetdQlwF+h9XAUKlN7HGDZWTodVhNDXWDNYu4D9sKc0ONl2FtZOhlGdDQ8HZn5T5yQxobKt/C2sbQr7C2M1Tq4E1Y2xpqYj8arA6GnkwDOhl60WB1NFTyw9rdUHrNasNQdljtGOoGS+wGy5ahEhtWi4ZKvQwFhtWqociwWjbUpMI2WPYNlToOJU0DXBgqUetWR4aC1q3ODMWsWx0aKhnrVreGEsLq2vA2DeC9s7o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HCTVKRBPClAAAAAElFTkSuQmCC"
height="30" width="30" /></button>
</div>



<div class="nav-meal">
<a href="./meal.html">Meal</a>
<a href="./meal.html">Meal</a>
</div>

<div class="like-button">
<a href="./favourite.html"> <i class="fa-sharp fa-solid fa-heart"></i>
<span id="like-conunt">0</span></a>
<a href="./favourite.html" > <i class="fa-sharp fa-solid fa-heart"></i>
<span id="like-conunt">0</span></a>
</div>

</div>

</div>

</nav>

<main>

<!-- for showing common data to Deliver Restaurants in India-->
Expand Down
84 changes: 57 additions & 27 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@
<Link rel="stylesheet" href="./style/index.css">
</Link>
<link rel="stylesheet" href="./style/slider.css"></link>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/swiper@10/swiper-bundle.min.css"
/>

<!-- bootstrap cdn -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">

Expand All @@ -22,9 +19,7 @@
<!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/assets/owl.carousel.min.css" integrity="sha512-tS3S5qG0BlhnQROyJXvNjeEM4UpMXHrQfTGmbQ1gKmelCxlSEBUaxhRBj/EFTzpbP4RVSrpEikbmdJobCvhE3g==" crossorigin="anonymous" referrerpolicy="no-referrer" /> -->
<!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/assets/owl.theme.default.css" integrity="sha512-OTcub78R3msOCtY3Tc6FzeDJ8N9qvQn1Ph49ou13xgA9VsH9+LRxoFU6EqLhW4+PKRfU+/HReXmSZXHEkpYoOA==" crossorigin="anonymous" referrerpolicy="no-referrer" /> -->

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/assets/owl.carousel.min.css" integrity="sha512-tS3S5qG0BlhnQROyJXvNjeEM4UpMXHrQfTGmbQ1gKmelCxlSEBUaxhRBj/EFTzpbP4RVSrpEikbmdJobCvhE3g==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/assets/owl.theme.default.min.css" integrity="sha512-sMXtMNL1zRzolHYKEujM2AqCLUR9F2C4/05cdbxjjLSRvMQIciEPCQZo++nk7go3BtSuK9kfa/s+a4f4i5pLkw==" crossorigin="anonymous" referrerpolicy="no-referrer" />

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper@10/swiper-bundle.min.css" />

</head>

Expand All @@ -33,10 +28,10 @@
<nav>
<div class="nav-container">

<div class="nav-left">
<div class="nav-left d-block">
<div class="nav-logo">
<a href="index.html"><i class="fa-solid fa-utensils"></i></a>
<span>Pour Tous</span>
<span id="pour-tous">Pour Tous</span>
</div>
</div>

Expand Down Expand Up @@ -103,15 +98,24 @@
</div>

<!-- category section -->

<div class="container-fluid py-4" style="background-color:#FEDE00; height:400px;">
<h3 class="py-2" style="color:black; font-size:2rem;font-weight:400;">What's on your mind?</h3>
<div id="category" class="owl-carousel owl-theme">

<!-- data is fetched from index.js -->

</div>
</div>
<section class="slider_container pt-3" style="background-color:#FEDE00; height:300px;">
<div class="container">

<div class="card_slider swiper">
<div class="swiper-wrapper" id="category">

</div>
<div class="swiper-button-next"></div>
<div class="swiper-button-prev"></div>
<div class="swiper-pagination"></div>
</div>
</div>

</section>



<!-- for showing common data to Deliver Restaurants in India-->
<div class="container-fluid py-1" style="background-color:black">
<h3 class="py-1" style="color:#FEDE00; font-size:2rem;font-weight:400;">You can also try</h3>
Expand Down Expand Up @@ -167,6 +171,7 @@ <h3 class="py-1" style="color:#FEDE00; font-size:2rem;font-weight:400;">You can
</div>


</div>
</div>
</fotter>

Expand All @@ -188,16 +193,41 @@ <h3 class="py-1" style="color:#FEDE00; font-size:2rem;font-weight:400;">You can
<script src="https://cdn.jsdelivr.net/npm/swiper@10/swiper-bundle.min.js"></script>

<!-- Initialize Swiper -->
<script>
var swiper = new Swiper(".mySwiper", {
slidesPerView: 4,
spaceBetween: 30,
centeredSlides: true,
pagination: {
el: ".swiper-pagination",
clickable: true
}
});
<script type="text/javascript">
var swiper = new Swiper(".card_slider", {
slidesPerView: 3,
spaceBetween: 70,
loop:true,
pagination: {
el: ".swiper-pagination",
clickable: true,
},
autoplay: {
delay: 2500,
disableOnInteraction: false,
},
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
}, breakpoints: {
320: {
slidesPerView: 1,

},
480: {
slidesPerView: 2,

},
768: {
slidesPerView: 3,

},
1200: {
slidesPerView: 4,

},
},
});
</script>
</body>

Expand Down
50 changes: 33 additions & 17 deletions js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ let MainFoodList =[];
let suggestedFoodList=[];
let suggestdata ="";
let dummy = "";

let favouriteItemList = JSON.parse(window.localStorage.getItem("favourite")) || [];

count.innerHTML=favouriteItemList.length;
Expand Down Expand Up @@ -92,6 +93,7 @@ try{
showSuggestion()
}catch(err){
console.log(err);
alert("Sorry,this item is not available right now!!")
}

}
Expand All @@ -115,12 +117,14 @@ InputValue.addEventListener("input",async()=>{
try{
const suggestionapi = await fetch(`https://www.themealdb.com/api/json/v1/1/search.php?s=${inputdata}`);
const suggestiondata = await suggestionapi.json();

suggestedFoodList=suggestiondata.meals;
console.log("suggestedFoodList",suggestedFoodList);

if(suggestedFoodList==null){
return;
}
}catch(err){
// alert("Sorry,this item is not available right now!!")
console.log(err);
}
// suggestedFoodList = [1,2,3,4,5,6];
displaysuggestion.innerHTML= "";
Expand Down Expand Up @@ -153,24 +157,31 @@ InputValue.addEventListener("input",async()=>{
const categoryapi = await fetch("https://www.themealdb.com/api/json/v1/1/categories.php");
const categorydata = await categoryapi.json();
console.log(categorydata);
categoryList=categorydata.categories.slice(0,5);
categoryList=categorydata.categories;

showInCategory();
}

handleCategory();



//function for showing category
function showInCategory(){
console.log(categoryList.categories);
category.innerHTML += categoryList.map((categories,index)=>(

`
<div style="text-align:center;" class="item" onclick="handleCategoryList(${index})">
<img src="${categories.strCategoryThumb
}"/>
<span style="font-size:1.3rem;font-weight:500;">${categories.strCategory}</span>
<div class="swiper-slide pb-5"
onclick="handleCategoryList(${index})">
<div class="img-box text-center">
<img src="${categories.strCategoryThumb
}" alt=""/>
<span class="text-d">${categories.strCategory}</span>
</div>
</div>
`
))
Expand All @@ -186,7 +197,8 @@ InputValue.addEventListener("input",async()=>{

function MainDisplay(){
// fetched data from api in the category section.
let categoryname = "";
let categorynamemain = "p";

async function handleMainFood(){
dummy =document.getElementById("InputValue").value;
document.getElementById("InputValue").value="";
Expand All @@ -198,28 +210,32 @@ function MainDisplay(){
try {
const categoryObject = JSON.parse(localcategory);
console.log("***", categoryObject.strCategory);
categoryname = categoryObject.strCategory;
categorynamemain = categoryObject.strCategory;
} catch (error) {
console.error("Error parsing JSON:", error);
}
const defaultdummy = "p";
console.log(dummy);
console.log(categoryname,localcategory);
console.log(categorynamemain ,localcategory);
// suggestdata = JSON.parse(window.localStorage.getItem("suggestion"));
// console.log("suggestdata",suggestdata.strMeal);
// InputValue.value = suggestdata.strMeal;
console.log(dummy,categoryname,defaultdummy);
console.log(dummy,categorynamemain ,defaultdummy);
try{
const categoryapi = await fetch(`https://www.themealdb.com/api/json/v1/1/search.php?s=${dummy==="" ? categoryname : dummy}`);
const categoryapi = await fetch(`https://www.themealdb.com/api/json/v1/1/search.php?s=${dummy==="" ? categorynamemain : dummy}`);
const categorydata = await categoryapi.json();
// suggestdata ="";

MainFoodList=categorydata.meals;
console.log("MainFoodList",MainFoodList);
// InputValue.value="";

if(MainFoodList === null){
alert("Sorry,this item is not available right now!!")
return;
}
showInMain();
}catch(err){
// alert("Sorry,this item is not available right now!!")
alert("Sorry,this item is not available right now!!")
console.log("err",err);
}

Expand All @@ -233,7 +249,7 @@ function MainDisplay(){
mainFoodSection.innerHTML += MainFoodList?.map((meals,index)=>(
`
<div class="items my-3 mx-1" >
<div class="items my-3 mx-1" id="item-imp" >
<div class="container-main-meals my-4 ">
<img onclick="addMeal(${meals.idMeal })" src="${meals.strMealThumb
}"/>
Expand Down
Loading

0 comments on commit 5adbe2f

Please sign in to comment.