|
| 1 | +import Image from "next/image"; |
| 2 | +import { |
| 3 | + RiBusLine, |
| 4 | + RiCalendarLine, |
| 5 | + RiHotelLine, |
| 6 | + RiMapPinTimeLine, |
| 7 | + RiStarFill, |
| 8 | + RiTimeLine, |
| 9 | +} from "react-icons/ri"; |
| 10 | + |
| 11 | +// ** data |
| 12 | +import { Ticket } from "@/data/tickets"; |
| 13 | + |
| 14 | +interface TicketCardProps { |
| 15 | + ticket: Ticket; |
| 16 | +} |
| 17 | +export const TicketCard = ({ ticket }: TicketCardProps) => { |
| 18 | + return ( |
| 19 | + <div |
| 20 | + className="mx-4 flex min-h-64 |
| 21 | + max-w-[850px] flex-col gap-y-5 rounded-xl border-2 border-zinc-700 bg-zinc-800 px-4 md:flex-row-reverse md:gap-4" |
| 22 | + > |
| 23 | + <div className="pt-4 md:border-r md:border-zinc-700 md:pb-4 md:pr-4"> |
| 24 | + <Image |
| 25 | + src={ticket.image.desktop.src} |
| 26 | + alt={ticket.image.desktop.alt} |
| 27 | + className="hidden size-52 rounded-xl md:flex" |
| 28 | + /> |
| 29 | + <Image |
| 30 | + src={ticket.image.mobile.src} |
| 31 | + alt={ticket.image.mobile.alt} |
| 32 | + className="w-full rounded-xl md:hidden " |
| 33 | + /> |
| 34 | + </div> |
| 35 | + <div className="flex flex-1 flex-col gap-y-5 pb-4 md:items-start md:justify-between md:pt-4"> |
| 36 | + <div className="space-y-1"> |
| 37 | + <div className=" md:flex md:justify-between"> |
| 38 | + <p className=" text-2xl font-bold md:text-start md:text-3xl"> |
| 39 | + {ticket.title} |
| 40 | + </p> |
| 41 | + <p className="text-2xl font-bold text-green-500">{ticket.price}</p> |
| 42 | + </div> |
| 43 | + <p className=" text-lg leading-7 text-zinc-200 md:text-start md:text-xl"> |
| 44 | + {ticket.description} |
| 45 | + </p> |
| 46 | + </div> |
| 47 | + {ticket.type === "PLACE" ? ( |
| 48 | + <div className="w-full"> |
| 49 | + <div className="mt-2 flex justify-between"> |
| 50 | + <span className=" text-2xl font-semibold text-zinc-300 md:text-start md:text-3xl"></span> |
| 51 | + <span className="text-xl text-yellow-500 md:hidden">۵ ستاره</span> |
| 52 | + <div className=" hidden md:flex"> |
| 53 | + {Array.from({ length: ticket.hotel.rate.value }).map( |
| 54 | + (_, index) => ( |
| 55 | + <RiStarFill |
| 56 | + key={index + ticket.hotel.rate.value} |
| 57 | + className="text-lg text-yellow-500" |
| 58 | + /> |
| 59 | + ), |
| 60 | + )} |
| 61 | + </div> |
| 62 | + </div> |
| 63 | + <div className="md:flex md:justify-between"> |
| 64 | + <div className="mt-3 flex items-center gap-2"> |
| 65 | + <RiTimeLine className="text-xl" /> |
| 66 | + <span className="text-zinc-200">{ticket.time}</span> |
| 67 | + </div> |
| 68 | + <div className=" flex items-center gap-2"> |
| 69 | + <RiCalendarLine className="text-xl" /> |
| 70 | + <span className="text-zinc-200">{ticket.date}</span> |
| 71 | + </div> |
| 72 | + </div> |
| 73 | + </div> |
| 74 | + ) : ticket.type === "TRANSPORT" ? ( |
| 75 | + <div className="w-full"> |
| 76 | + <div className="mt-3 flex flex-nowrap items-center text-zinc-200"> |
| 77 | + <RiMapPinTimeLine className="text-2xl" /> |
| 78 | + <hr className="border-1 mx-5 flex-1 border-zinc-700" /> |
| 79 | + <RiBusLine className="text-2xl" /> |
| 80 | + <hr className="border-1 mx-5 flex-1 border-zinc-700" /> |
| 81 | + <RiHotelLine className="text-2xl" /> |
| 82 | + </div> |
| 83 | + <div className="mt-3 flex justify-between "> |
| 84 | + <p className="text-lg text-zinc-200"> |
| 85 | + {ticket.origin.title} |
| 86 | + <br /> |
| 87 | + {ticket.origin.time} |
| 88 | + </p> |
| 89 | + <p className="text-end text-lg text-zinc-200"> |
| 90 | + {ticket.destination.title} |
| 91 | + <br /> |
| 92 | + {ticket.destination.time} |
| 93 | + </p> |
| 94 | + </div> |
| 95 | + </div> |
| 96 | + ) : ticket.type === "MEET" ? ( |
| 97 | + <></> |
| 98 | + ) : null} |
| 99 | + </div> |
| 100 | + </div> |
| 101 | + ); |
| 102 | +}; |
0 commit comments