diff --git a/components/Tickets/ticketCards.js b/components/Tickets/ticketCards.js index 5f73b8e4..36af803e 100644 --- a/components/Tickets/ticketCards.js +++ b/components/Tickets/ticketCards.js @@ -1,32 +1,50 @@ -import React from 'react'; +import React, { useEffect, useState } from 'react'; import Button from '../Buttons/button'; +import cityList from '../../config/city-lists.json'; // Adjust the path to your JSON file -function TicketCards({ className, city }) { - // Determine card style based on event status - const isEndedOrUpcoming = city.ended || !city.ticket; - const cardOpacity = isEndedOrUpcoming ? 'opacity-40' : 'opacity-100'; - const buttonText = city.isFree ? 'Get Your Ticket' : 'Buy Now'; +function TicketCards({ className }) { + const [eventsData, setEventsData] = useState([]); + + useEffect(() => { + // Set the event data from the imported JSON file + setEventsData(cityList); + }, []); return ( -
-
-
{city.name}, {city.country}
-
{city.date}
-
-
- {/* Show a button based on the event status */} - {isEndedOrUpcoming ? ( - - ) : ( - - - - )} -
+
+ {eventsData.map((city) => { + // Determine card style based on event status + const isEndedOrUpcoming = city.ended || !city.ticket; + const cardOpacity = isEndedOrUpcoming ? 'opacity-40' : 'opacity-100'; + const buttonText = city.isFree ? 'Get Your Ticket' : 'Buy Now'; + + return ( +
+
+
{city.name}, {city.country}
+
{city.date}
+
{city.description}
{/* Added description */} +
+
+ {/* Show a button based on the event status */} + {isEndedOrUpcoming ? ( + + ) : ( + + + + )} +
+
+ ); + })}
); } -export default TicketCards; \ No newline at end of file +export default TicketCards;