mirror of
https://github.com/UofCBaja/BajaUofCWebsite.git
synced 2025-07-08 12:17:13 -06:00
Seperated json access code to own file (Brock get AirBnB)
This commit is contained in:
11
src/Images/ImageFinder.js
Normal file
11
src/Images/ImageFinder.js
Normal file
@ -0,0 +1,11 @@
|
||||
import imagesData from './Images.json';
|
||||
|
||||
// Function to search and filter images based on the provided category
|
||||
export const ImageFinder = (category) => {
|
||||
if (category === 'all') {
|
||||
return imagesData;
|
||||
} else {
|
||||
const filteredImages = imagesData.filter(image => image.category === category);
|
||||
return filteredImages;
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user