From 064322e4f032a6cb2d802cb60674dd3c03b0e86d Mon Sep 17 00:00:00 2001 From: Sarim-Sheikh-2003 Date: Wed, 7 Feb 2024 19:31:52 -0700 Subject: [PATCH] Moved image library from Gallery.js to a seperate json file --- package-lock.json | 2 +- package.json | 2 +- src/Gallery/Gallery.js | 14 +++--------- src/Images/Images.json | 51 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 56 insertions(+), 13 deletions(-) create mode 100644 src/Images/Images.json diff --git a/package-lock.json b/package-lock.json index 15ebe0a..60b3731 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,7 @@ "react-modal": "^3.16.1", "react-native": "^0.72.6", "react-router-dom": "^6.20.0", - "react-scripts": "5.0.1", + "react-scripts": "^5.0.1", "web-vitals": "^2.1.4" } }, diff --git a/package.json b/package.json index 8773162..ce6912c 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "react-modal": "^3.16.1", "react-native": "^0.72.6", "react-router-dom": "^6.20.0", - "react-scripts": "5.0.1", + "react-scripts": "^5.0.1", "web-vitals": "^2.1.4" }, "scripts": { diff --git a/src/Gallery/Gallery.js b/src/Gallery/Gallery.js index 7065e12..96dac1b 100644 --- a/src/Gallery/Gallery.js +++ b/src/Gallery/Gallery.js @@ -1,22 +1,14 @@ import Modal from 'react-modal'; import { useState } from "react"; import './Gallery.css'; - -const images = [ - { src: 'https://i.pinimg.com/736x/70/28/0f/70280f1b75ea956f4fdef7e31336d9f0.jpg', alt: 'Image 1' }, - { src: 'https://wallpapers.com/images/featured-full/cool-anime-6kbwj9794wpnsfr1.jpg', alt: 'Image 2' }, - { src: 'https://wallpapers.com/images/featured/cool-anime-pfp-pictures-71urutpksg13vkbk.jpg', alt: 'Image 3' }, - { src: 'https://i.pinimg.com/236x/ab/dc/52/abdc52db893674a7b5dcb767be8776e5.jpg', alt: 'Image 4' }, - { src: 'https://qph.cf2.quoracdn.net/main-qimg-a3fdbac7bf9f8db58f147887ffa76d88-lq', alt: 'Image 5' }, - { src: 'https://i.redd.it/people-already-making-good-use-of-that-public-domain-v0-krh76hi874ac1.png?width=2000&format=png&auto=webp&s=405581952294275a5d6cf05a97c05b3387b73f34', alt: 'Image 6'} -]; +import imagesData from '../Images/Images.json'; // Import the JSON file /** * @param {null} null - requires onthing * @returns {JSX.Element} JSX - HTML tags and JS functionality * @description Gallery Page * @author Sarim - * @todo move url links to json file until backend is imlemented + * @todo Add comments */ export default function Gallery() { const [open, setOpen] = useState(false) @@ -32,7 +24,7 @@ export default function Gallery() { return (
- {images.map((image, index) => ( + {imagesData.map((image, index) => (