Skip to content

Commit

Permalink
Merge pull request #53 from Lorg0n/feture/AddSortToFranchise
Browse files Browse the repository at this point in the history
feature: add sort to franchise
  • Loading branch information
olexh authored Jul 2, 2024
2 parents f3a8231 + 9b482a8 commit b9b71d6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion features/anime/anime-view/franchise.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ const Franchise: FC<Props> = ({ extended }) => {
return null;
}

const filteredData = extended ? franchise.list : franchise.list.slice(0, 4);
const sortedList = franchise.list.sort((a, b) => (a.year < b.year ? 1 : -1));
const filteredData = extended ? sortedList : sortedList.slice(0, 4);

return (
<Block>
Expand Down
3 changes: 2 additions & 1 deletion features/manga/manga-view/franchise.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ const Franchise: FC<Props> = ({ extended }) => {
return null;
}

const filteredData = extended ? franchise.list : franchise.list.slice(0, 4);
const sortedList = franchise.list.sort((a, b) => (a.year < b.year ? 1 : -1));
const filteredData = extended ? sortedList : sortedList.slice(0, 4);

return (
<Block>
Expand Down
3 changes: 2 additions & 1 deletion features/novel/novel-view/franchise.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ const Franchise: FC<Props> = ({ extended }) => {
return null;
}

const filteredData = extended ? franchise.list : franchise.list.slice(0, 4);
const sortedList = franchise.list.sort((a, b) => (a.year < b.year ? 1 : -1));
const filteredData = extended ? sortedList : sortedList.slice(0, 4);

return (
<Block>
Expand Down

0 comments on commit b9b71d6

Please sign in to comment.