|
| 1 | +import React from "react"; |
| 2 | +import Book1 from "../../../assets/Books/Book1.png"; |
| 3 | +import Book2 from "../../../assets/Books/Book2.png"; |
| 4 | +import Book3 from "../../../assets/Books/Book3.png"; |
| 5 | +import Book4 from "../../../assets/Books/Book4.jpg"; |
| 6 | +import Book5 from '../../../assets/Books/Book5.png' |
| 7 | +const BookList = () => { |
| 8 | + const Books = [ |
| 9 | + { |
| 10 | + id: 1, |
| 11 | + img: Book1, |
| 12 | + name: "Learning the HTML for Beginner", |
| 13 | + subName: "step by step Guide", |
| 14 | + mrp: 300, |
| 15 | + price: 149, |
| 16 | + currency: "₹", |
| 17 | + url: "https://rzp.io/l/LearnHTML", |
| 18 | + }, |
| 19 | + { |
| 20 | + id: 2, |
| 21 | + img: Book2, |
| 22 | + name: "Javascript Note for beginner to advanced", |
| 23 | + subName: "step by step Guide", |
| 24 | + mrp: 398, |
| 25 | + price: 199, |
| 26 | + currency: "₹", |
| 27 | + url: "https://rzp.io/l/LearnJavaScript", |
| 28 | + }, |
| 29 | + { |
| 30 | + id: 3, |
| 31 | + img: Book3, |
| 32 | + name: "Top 50 + Linux command for Programmer", |
| 33 | + subName: "step by step Guide", |
| 34 | + mrp: 300, |
| 35 | + price: 149, |
| 36 | + currency: "₹", |
| 37 | + url: "https://rzp.io/l/LearnLinux", |
| 38 | + }, |
| 39 | + { |
| 40 | + id: 4, |
| 41 | + img: Book4, |
| 42 | + name: "Complete overview of frontend Developer", |
| 43 | + subName: "step by step Guide", |
| 44 | + mrp: 398, |
| 45 | + price: 199, |
| 46 | + currency: "₹", |
| 47 | + url: "https://rzp.io/l/tGzMyKep", |
| 48 | + }, |
| 49 | + { |
| 50 | + id: 5, |
| 51 | + img: Book5, |
| 52 | + name: "The road to learn pure react.js for beginner", |
| 53 | + subName: "step by step Guide", |
| 54 | + mrp: 398, |
| 55 | + price: 199, |
| 56 | + currency: "₹", |
| 57 | + url: "https://rzp.io/l/LearnReactjs", |
| 58 | + }, |
| 59 | + ]; |
| 60 | + |
| 61 | + const openUrl = (url) => { |
| 62 | + window.open(url, "_blank", "noopener,noreferrer"); |
| 63 | + }; |
| 64 | + return ( |
| 65 | + <div className="flex flex-wrap gap-x-5 gap-y-2 justify-center mx-auto"> |
| 66 | + {Books.map((item) => ( |
| 67 | + <div |
| 68 | + key={item.id} |
| 69 | + className="p-2 w-[200px] h-[350px] bg-white shadow-black shadow-lg rounded-lg flex flex-col items-center m-2 pt-1" |
| 70 | + > |
| 71 | + <div className="w-[150px] h-[203px] rounded-lg overflow-hidden border-[1px] border-black"> |
| 72 | + <img src={item.img} alt={item.name} className="w-full h-full" /> |
| 73 | + </div> |
| 74 | + <div className="text-center text-sm font-medium mt-2"> |
| 75 | + {item.name} |
| 76 | + </div> |
| 77 | + <div className="text-center text-[10px] font-medium"> |
| 78 | + {item.subName} |
| 79 | + </div> |
| 80 | + <div className="text-base text-center font-bold my-2"> |
| 81 | + <span className="text-gray-500 line-through">{item.mrp}</span> |
| 82 | + <span>{` ${item.currency} ${item.price} `}</span> |
| 83 | + <span className="text-[12px] text-green-600">50% off</span> |
| 84 | + </div> |
| 85 | + <button |
| 86 | + onClick={() => openUrl(item.url)} |
| 87 | + target="_blank" |
| 88 | + className="hover:bg-orange-500 mx-6 text-sm font-medium text-center border-2 border-orange-600 bg-orange-600 rounded-full py-1 px-2.5 text-white" |
| 89 | + > |
| 90 | + Buy Now |
| 91 | + </button> |
| 92 | + </div> |
| 93 | + ))} |
| 94 | + </div> |
| 95 | + ); |
| 96 | +}; |
| 97 | + |
| 98 | +export default BookList; |
0 commit comments