diff --git a/src/app/shop/page.tsx b/src/app/shop/page.tsx
index d7726fe..1626553 100644
--- a/src/app/shop/page.tsx
+++ b/src/app/shop/page.tsx
@@ -9,7 +9,7 @@ const artifacts = [
{ id: 3, name: "Medieval Chalice", description: "Used by royalty in medieval ceremonies.", location: "Cambridge, England", image: "/images/artifact3.jpg", price: 120 },
{ id: 4, name: "Roman Coin", description: "An authentic Roman coin from the 2nd century CE.", location: "Rome, Italy", image: "/images/artifact4.jpg", price: 80 },
{ id: 5, name: "Samurai Mask", description: "Replica of Japanese Samurai battle masks.", location: "Tokyo, Japan", image: "/images/artifact5.jpg", price: 300 },
- { id: 6, name: "Ancient Greek Vase", description: "Depicts Greek mythology.", location: "Athens, Greece", image: "/images/artifact6.jpg", price: 250 },
+ { id: 6, name: "Ancient Greek Vase", description: "Depicts Greek mythology, found in the Acropolis.", location: "Athens, Greece", image: "/images/artifact6.jpg", price: 250 },
{ id: 7, name: "Incan Pendant", description: "Represents the Sun God Inti.", location: "India", image: "/images/artifact7.jpg", price: 175 },
{ id: 8, name: "Persian Carpet Fragment", description: "Ancient Persian artistry.", location: "Petra, Jordan", image: "/images/artifact8.jpg", price: 400 },
{ id: 9, name: "Stone Buddha", description: "Authentic stone Buddha carving.", location: "India", image: "/images/artifact9.jpg", price: 220 },
@@ -18,36 +18,84 @@ const artifacts = [
{ id: 12, name: "Ming Dynasty Porcelain", description: "Porcelain from China's Ming Dynasty.", location: "Beijing, China", image: "/images/artifact12.jpg", price: 300 },
{ id: 13, name: "African Tribal Mask", description: "A unique tribal mask from Africa.", location: "Nigeria", image: "/images/artifact13.jpg", price: 250 },
{ id: 14, name: "Crystal Skull", description: "A mystical pre-Columbian artifact.", location: "Colombia", image: "/images/artifact14.jpg", price: 1000 },
- { id: 15, name: "Medieval Armor Fragment", description: "A fragment of medieval knight's armor.", location: "Normandy, France", image: "/images/artifact15.jpg", price: 400 },
+ { id: 15, name: "Medieval Armor Fragment", description: "A fragment of medieval armor.", location: "Normandy, France", image: "/images/artifact15.jpg", price: 400 },
];
+// Modal Component
+const Modal = ({ artifact, onClose }) => {
+ if (!artifact) return null;
+
+ const handleOverlayClick = (e) => {
+ if (e.target === e.currentTarget) {
+ onClose();
+ }
+ };
+
+ return (
+
+
+
{artifact.name}
+

+
{artifact.description}
+
Location: {artifact.location}
+
Price: ${artifact.price}
+
+
+
+
+
+
+
+ );
+};
+
// ArtifactCard Component
-const ArtifactCard = ({ artifact }) => {
+const ArtifactCard = ({ artifact, onSelect }) => {
const [selectedCurrency, setSelectedCurrency] = useState("USD");
const conversionRates = { USD: 1, EUR: 0.94, GBP: 0.81 };
const convertPrice = (price, currency) => (price * conversionRates[currency]).toFixed(2);
+ const handleCurrencyChange = (e) => {
+ setSelectedCurrency(e.target.value); // Update selected currency
+ e.stopPropagation(); // Prevent the modal from opening on dropdown click
+ };
return (
-
+
onSelect(artifact)} // Opens modal
+ >
{artifact.name}
{artifact.description}
{artifact.location}
-
-
- {selectedCurrency}: {convertPrice(artifact.price, selectedCurrency)}
-
-
+
+
+
+
);
@@ -56,66 +104,82 @@ const ArtifactCard = ({ artifact }) => {
// Shop Component
export default function Shop() {
const [currentPage, setCurrentPage] = useState(1);
- const artifactsPerPage = 6;
-
+ const [selectedArtifact, setSelectedArtifact] = useState(null); // Track selected artifact for modal
+ const artifactsPerPage = 9; // Number of artifacts per page
const indexOfLastArtifact = currentPage * artifactsPerPage;
const indexOfFirstArtifact = indexOfLastArtifact - artifactsPerPage;
const currentArtifacts = artifacts.slice(indexOfFirstArtifact, indexOfLastArtifact);
const handleNextPage = () => {
- if (indexOfLastArtifact < artifacts.length) setCurrentPage((prev) => prev + 1);
+ if (indexOfLastArtifact < artifacts.length) {
+ setCurrentPage((prev) => prev + 1);
+ }
};
const handlePreviousPage = () => {
- if (currentPage > 1) setCurrentPage((prev) => prev - 1);
+ if (currentPage > 1) {
+ setCurrentPage((prev) => prev - 1);
+ }
+ };
+
+ const handleSelectArtifact = (artifact) => {
+ setSelectedArtifact(artifact); // Open modal with selected artifact
+ };
+
+ const handleCloseModal = () => {
+ setSelectedArtifact(null); // Close modal
};
return (
-
- {/* Artifact Grid */}
-
- {currentArtifacts.map((artifact) => (
-
- ))}
+
+ {/* Main Content */}
+
+ {/* Artifact Grid */}
+
+ {currentArtifacts.map((artifact) => (
+
+ ))}
+
+
+ {/* Sidebar */}
+
- {/* Footer Fixed at Bottom */}
-
);
-}
\ No newline at end of file
+}