diff --git a/src/App.tsx b/src/App.tsx index b16f189..b0cac70 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -56,7 +56,7 @@ export default function App() {
- {/* TODO - shows.map((show)=>{ return })*/} + {shows.map((show)=>{ return })}
diff --git a/src/components/showCard/ShowCard.tsx b/src/components/showCard/ShowCard.tsx index 7e18a47..c61b46d 100644 --- a/src/components/showCard/ShowCard.tsx +++ b/src/components/showCard/ShowCard.tsx @@ -10,63 +10,56 @@ export interface ShowCardProps { } export default function ShowCard( - /* TODO 1: Accept props with ShowCardProps type here */ + {artist, stage, day, hour, ticketsLeft, image}: ShowCardProps ) { - // TODO 2: Create state called isInterested of type boolean (default false) - // const [isInterested, setIsInterested] = ... - // TODO 3: Function that toggles true/false in isInterested - // function handleToggleInterested() {} + const [isInterested, setIsInterested] = useState(false) - // TODO 4: Create ticketsStatusText (string): - // 0 → "SOLD OUT" - // 1–30 → "Last tickets – hurry up!" - // >30 → "Tickets available" + function handleToggleInterested() { + setIsInterested(!isInterested) + } - // TODO 5: Create text for interest status based on isInterested: - // false → "You haven't added this show yet" - // true → "This show is in your interested list 🎟️" + const lastTicketsAmount = 30 + const ticketsSoldOut = 0; + function ticketsStatusText(): string { + return ticketsLeft === ticketsSoldOut? "SOLD OUT": ticketsLeft > lastTicketsAmount? "Tickets available": "Last tickets – hurry up!" + } + + const ticketsStatus = ticketsStatusText() + + const interestedStatusText = isInterested? "This show is in your interested list 🎟️": "You haven't added this show yet" return (
- {/* TODO 6: Replace placeholder with real from props */} - {/* {artist} */} + {artist}
Image goes here

- {/* TODO 7: If isInterested → show ⭐ before artist name */} - "Artist name here" + {isInterested && "⭐"} {artist}

- {/* TODO 8: Display stage, day, hour from props */} - "Stage · Day · Hour" + {`${stage} ${day} ${hour}`}

- {/* TODO 9: Display the ticketsStatusText */} - "Tickets status text" + {ticketsStatus}

- {/* TODO 10: Display the interestedText */} - "Interested status text" + {interestedStatusText}

);