From d255c904a9b56d53a5d970042368e00f7ff1fa09 Mon Sep 17 00:00:00 2001 From: Azat Ismagilov Date: Sat, 3 Aug 2024 00:38:20 +0100 Subject: [PATCH] chore: Fix sorting issue in PhotoGridByYear component This commit fixes a sorting issue in the PhotoGridByYear component. The index difference calculation in the `PhotoGridByYear` component was incorrect, causing the sorting to be reversed. This commit corrects the calculation to ensure the correct sorting order is maintained. ``` --- src/components/Body/PhotoGridByYear.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Body/PhotoGridByYear.jsx b/src/components/Body/PhotoGridByYear.jsx index d175923..15f9133 100644 --- a/src/components/Body/PhotoGridByYear.jsx +++ b/src/components/Body/PhotoGridByYear.jsx @@ -26,7 +26,7 @@ const PhotoGridByYear = ({ photos, handleClick }) => { const yearA = a[0]; const yearB = b[0]; const yearIndex = (targetYear) => places.findIndex(({ year }) => year === targetYear); - const indexDiff = yearIndex(yearA) - yearIndex(yearB); + const indexDiff = yearIndex(yearB) - yearIndex(yearA); if (indexDiff !== 0) { return indexDiff; }