Skip to content

Commit

Permalink
Merge pull request #1190 from karthiknadar1204/main
Browse files Browse the repository at this point in the history
Added dynamic iskcon events
  • Loading branch information
akshitagupta15june authored Jul 25, 2023
2 parents 885e520 + ffab2cc commit 024bd4d
Show file tree
Hide file tree
Showing 8 changed files with 205 additions and 40 deletions.
Binary file added Images/Gita_Jayanti.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/Govardhan.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/Jhulan.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/krishna_iskcon.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/padmini.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
52 changes: 52 additions & 0 deletions Iskcon/data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
[
{
"id": 1,
"image": "../Images/Govardhan.jpeg",
"heading": "Govardhana Puja",
"description": "Govardhana Puja is a festival celebrating the Govardhana lila of Lord Krishna. On this day, Go-Puja is also performed as part of the festival.",
"date": "Tue 14th November 2023",
"btnText": "Book Tickets",
"link": "https://www.iskconbangalore.org/govardhana-puja/",
"state": "Bangalore"
},
{
"id": 2,
"image": "../Images/padmini.jpeg",
"heading": "Padmini Ekadashi",
"description": "The date of Padmini Ekadashi also comes only once every three years.",
"date": "Sat 29th July 2023",
"btnText": "Book Tickets",
"state": "Bangalore"
},
{
"id": 3,
"image": "../Images/krishna_iskcon.jpeg",
"heading": "Sri Krishna Janmashtami",
"description": "Sri Krishna Janmashtami (August 19, 2022) is the most important festival to celebrate the birth of Lord Krishna.",
"date": "Sun 6th September 2023",
"btnText": "Book Tickets",
"link": "https://www.iskconbangalore.org/sri-krishna-janmashtami/",
"state": "Mumbai"
},
{
"id": 4,
"image": "../Images/Jhulan.jpeg",
"heading": "Jhulan Utsava",
"description": "Jhulan utsava is celebrated for five days in the month of Shravana. Deities of Radha and Krishna are gently swayed on the swing.",
"date": "Sun 27th August 2023",
"btnText": "Book Tickets",
"link": "https://www.iskconbangalore.org/jhulan-utsava/",
"state": "Vellore"
},
{
"id": 5,
"image": "../Images/Gita_Jayanti.jpeg",
"heading": "Gita Jayanti Mahotsava",
"description": "Gita Jayanti is the auspicious day of the advent of Srimad Bhagavad-gita. This is the day on which Lord Krishna imparted the essence of Vedic.",
"date": "Sat 23rd December 2023",
"btnText": "Book Tickets",
"link": "https://www.iskconbangalore.org/gita-jayanti/",
"state": "Delhi"
}
]

74 changes: 34 additions & 40 deletions Iskcon/event.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
<title>Iskcon Events</title>
<link rel="icon" type="image/x-icon" href="../Images/logoBgRemoved.webp" />
<link rel="stylesheet" href="../commonStyles.css">
<link rel="stylesheet" href="https://unpkg.com/swiper/swiper-bundle.min.css">


</head>

Expand Down Expand Up @@ -89,58 +91,34 @@ <h1 class="text-xl md:text-3xl mt-2 uppercase tracking-widest text-indigo-600 fo
</div>

</section>


</div>

<section
class="upcomingEvents h-auto lg:h-screen flex flex-col px-8 py-8 lg:my-0 items-center justify-evenly ">
<h1 class="font-semibold uppercase text-md text-indigo-600">
<span class="border-b-4 pb-1 border-double border-b-indigo-600 ">Upcoming Events</span>
</h1>
<div
class="cards grid grid-cols-1 my-8 lg:my-0 gap-y-10 lg:gap-y-0 lg:grid-cols-3 w-full justify-center place-items-center ">

<div
class="card bg-indigo-600 w-[300px] h-[480px] p-4 text-slate-100 rounded-md ease-in-out duration-300 hover:shadow-2xl hover:scale-110 flex flex-col justify-between gap-y-5 ">
<img src="../Images/xpression.jpg" alt="xpression" class="card-image w-full h-[210px] rounded-md">
<div class="card-body flex flex-col justify-evenly gap-y-4 text-sm grow">
<p class="card-title text-center font-semibold">Learning Mental Wellness</p>
<p>Xpression is UP’s biggest youth festival organized by ISKCON E.A.S.Y</p>
<span class="text-slate-400 font-semibold text-xs ">Fri 7 Apr 2023
</span>
<a href="https://xpression.co.in/" target="_blank"
class="font-semibold w-full bg-emerald-500 py-3 text-center uppercase tracking-widest ease-in-out duration-300 hover:bg-indigo-900 rounded-md">Book
Tickets</a>
</div>
</div>


<div
class="card bg-indigo-600 w-[300px] h-[480px] p-4 text-slate-100 rounded-md ease-in-out duration-300 hover:shadow-2xl hover:scale-110 flex flex-col justify-between gap-y-5 ">
<img src="../Images/ramn.jpg" alt="ramn" class="card-image w-full h-[210px] rounded-md">
<div class="card-body flex flex-col justify-evenly gap-y-4 text-sm grow">
<p class="card-title text-center font-semibold">Iskcon, Banglore</p>
<p>Sri Rama Navami</p>
<p class="text-slate-400 font-semibold text-xs ">Mar 30, 2023</p>
<a href="https://www.iskconbangalore.org/sri-rama-navami/" target="_blank"
class="font-semibold w-full bg-emerald-500 py-3 text-center uppercase tracking-widest ease-in-out duration-300 hover:bg-indigo-900 rounded-md">Visit</a>
</div>
</div>

<div
class="card bg-indigo-600 w-[300px] h-[480px] p-4 text-slate-100 rounded-md ease-in-out duration-300 hover:shadow-2xl hover:scale-110 flex flex-col justify-between gap-y-5 ">
<img src="../Images/krishna.jpeg" alt="krishna" class="card-image w-full h-[210px] rounded-md">
<div class="card-body flex flex-col justify-evenly gap-y-4 text-sm grow ">
<p class="card-title text-center font-semibold">Vedic Cultural Centre, New Delhi</p>
<p>ISKCON Temple Delhi-Glory Of India & Vedic Cultural Centre,
New Delhi</p>
<p class="text-slate-400 font-semibold text-xs ">March 28, 2023</p>
<a href="https://allevents.in/mobile/amp-event.php?event_id=10000514670141247" target="_blank"
class="font-semibold w-full bg-emerald-500 py-3 text-center uppercase tracking-widest ease-in-out duration-300 hover:bg-indigo-900 rounded-md">Visit</a>
<!-- Iskcon cards data start -->
<div class="search-container">
<input type="text" id="search-bar" placeholder="Search by state">
<button id="search-button" class="font-semibold bg-emerald-500 py-3 text-center uppercase tracking-widest ease-in-out duration-300 hover:bg-indigo-900 rounded-md w-24 ">
Search
</button>

</div>
<div
class="cards my-8 lg:my-0 w-full justify-center place-items-center">
<div class="swiper-container">
<div class="swiper-wrapper">
</div>
<div class="swiper-pagination"></div>
</div>
</div>

</div>
<!-- Iskcon cards data end -->
</section>


Expand Down Expand Up @@ -282,7 +260,23 @@ <h1 class="text-3xl projectName">Moksh</h1>



<script src="https://unpkg.com/swiper/swiper-bundle.min.js"></script>
<script src="../commonScript.js"></script>
<script src="./event.js"></script>

</body>
<style>
.swiper-container {
margin-bottom: 20px; /* Add the desired gap (in pixels) between cards */
}
.card {
width: 340px; /* Adjust the width as needed */
}

.card-image {
width: 100%; /* Set the image width to 100% of the card */
}
</style>


</html>
119 changes: 119 additions & 0 deletions Iskcon/event.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
function fetchData() {
return fetch('data.json')
.then(response => response.json())
.catch(error => console.error('Error fetching data:', error));
}

document.addEventListener('DOMContentLoaded', () => {
const swiper = new Swiper('.swiper-container', {
slidesPerView: 'auto',
loop: true,
grabCursor: true,
pagination: {
el: '.swiper-pagination',
clickable: true,
},
autoplay: {
delay: 5000,
disableOnInteraction: false,
},
});

let eventData;

fetchData().then(data => {
eventData = data;
createEventCards(data, swiper);
});

const searchInput = document.querySelector('#search-bar');
const searchButton = document.querySelector('#search-button');

function handleSearch() {
const searchText = searchInput.value.toLowerCase();
const filteredEvents = eventData.filter(event => event.state.toLowerCase().includes(searchText));
updateEventCards(filteredEvents, swiper);
}

searchInput.addEventListener('input', handleSearch);
searchButton.addEventListener('click', handleSearch);
});

function createEventCards(data, swiper) {
const eventCardsContainer = document.querySelector('.cards');

data.forEach(event => {
createEventCard(event, swiper, eventCardsContainer);
});

swiper.update();
}

function createEventCard(event, swiper, container) {
const { image, heading, description, date, btnText, link, state } = event;

const card = document.createElement('div');
card.classList.add('card', 'bg-indigo-600', 'w-[340px]', 'h-[480px]', 'p-4', 'text-slate-100', 'rounded-md', 'ease-in-out', 'duration-300', 'hover:shadow-2xl', 'hover:scale-110', 'flex', 'flex-col', 'justify-between', 'gap-y-5');
card.style.marginRight = '20px';
const imageElement = document.createElement('img');
imageElement.src = image;
imageElement.alt = heading;
imageElement.classList.add('card-image', 'w-full', 'h-[210px]', 'rounded-md');

const cardBody = document.createElement('div');
cardBody.classList.add('card-body', 'flex', 'flex-col', 'justify-evenly', 'gap-y-4', 'text-sm', 'grow');

const headingElement = document.createElement('p');
headingElement.classList.add('card-title', 'text-center', 'font-semibold');
headingElement.innerText = heading;

const descriptionElement = document.createElement('p');
descriptionElement.innerText = description;

const dateElement = document.createElement('span');
dateElement.classList.add('text-slate-400', 'font-semibold', 'text-xs');
dateElement.innerText = date;

const btn = document.createElement('a');
btn.href = link;
btn.target = "_blank";
btn.classList.add('font-semibold', 'w-full', 'bg-emerald-500', 'py-3', 'text-center', 'uppercase', 'tracking-widest', 'ease-in-out', 'duration-300', 'hover:bg-indigo-900', 'rounded-md');
btn.innerText = btnText;

const stateElement = document.createElement('span');
stateElement.classList.add('text-slate-400', 'font-semibold', 'text-xs');
stateElement.innerText = state;

cardBody.appendChild(headingElement);
cardBody.appendChild(descriptionElement);
cardBody.appendChild(dateElement);
cardBody.appendChild(stateElement);
cardBody.appendChild(btn);

card.appendChild(imageElement);
card.appendChild(cardBody);

container.appendChild(card);
swiper.appendSlide(card);
}

function updateEventCards(filteredEvents, swiper) {
const eventCardsContainer = document.querySelector('.cards');
const allCards = eventCardsContainer.querySelectorAll('.card');

allCards.forEach(card => {
card.style.display = 'none';
});

filteredEvents.forEach(event => {
const card = eventCardsContainer.querySelector(`[data-event-id="${event.id}"]`);
if (card) {
card.style.display = 'block';
} else {
createEventCard(event, swiper, eventCardsContainer);
}
});

swiper.update();
}

0 comments on commit 024bd4d

Please sign in to comment.