Skip to content

Commit

Permalink
refactor: prev/next links
Browse files Browse the repository at this point in the history
  • Loading branch information
esemyonov committed Dec 17, 2023
1 parent 226d62e commit 06c6475
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/components/PrevNextLinks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,9 @@ function PageLink({
);
}
function collect(array: Array<NavCategory>, result: Array<NavCategory>): void {
array.forEach((el) => {
if (el.items) {
collect(el.items, result);
} else {
result.push(el);
}
});
array.forEach((value) =>
value.items ? collect(value.items, result) : result.push(value),
);
}

export function PrevNextLinks() {
Expand Down

0 comments on commit 06c6475

Please sign in to comment.