Skip to content

Commit

Permalink
chore: sorted versions in docs dropdown (#6659)
Browse files Browse the repository at this point in the history
* 13.0.0

* 14.0.0

* 15.0.0

* 16.0.0

* 17.0.0

* 18.0.0

* chore: version of the lib synced with the version of the angular

* chore(common-docs): added versions sorting

* chore(common-docs): switched from '+' to Number() for more explicit conversion
  • Loading branch information
lexasq authored Jul 4, 2024
1 parent 48d9655 commit 4a8a35e
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,11 @@ export class TopMenuComponent implements AfterViewInit {
this.http
.get<{ url: string; version: string; unprefixedUrl: string }[]>('assets/json/versions.json')
.subscribe((data) => {
this.previousDocs.push(data[0]);
this.previousDocs = this.previousDocs.concat(data.reverse()).slice(0, -1);
this.previousDocs = data.sort((versionA, versionB) => {
const versionAsNumberA = Number(versionA.version.split('.').join(''));
const versionAsNumberB = Number(versionB.version.split('.').join(''));
return versionAsNumberB - versionAsNumberA;
});
});

this.http.get<{ version: string }>('assets/json/current-version.json').subscribe((data: { version: string }) => {
Expand Down

0 comments on commit 4a8a35e

Please sign in to comment.