-
-
Notifications
You must be signed in to change notification settings - Fork 2k
docs(www): add version picker to side menu #5040
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
markostanimirovic
merged 5 commits into
ngrx:main
from
DuskoPeric:fix/add-version-picker
Dec 10, 2025
+219
−1
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
cd72f11
add version picker
DuskoPeric 553f5f4
Update projects/www/src/app/data/versionInfo.json
timdeschryver f405ab7
added suggested changes
DuskoPeric 9ed70ff
Merge branch 'fix/add-version-picker' of https://github.com/DuskoPeri…
DuskoPeric bbc274c
remove unused import
DuskoPeric File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
118 changes: 118 additions & 0 deletions
118
projects/www/src/app/components/version-navigation.component.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,118 @@ | ||
| import { Component, inject, signal, ElementRef } from '@angular/core'; | ||
| import { VersionInfoService } from '../services/versionInfo.service'; | ||
|
|
||
| @Component({ | ||
| selector: 'ngrx-version-navigation', | ||
| template: ` | ||
| @if (previousVersions && previousVersions.length > 0) { | ||
| <div class="version-navigation"> | ||
| <button | ||
| (click)="toggleDropdown()" | ||
| class="version-toggle-btn" | ||
| type="button" | ||
| > | ||
| <span>v{{ currentVersion }}</span> | ||
| <span class="arrow-icon" [class.rotated]="isDropdownVisible()">▼</span> | ||
| </button> | ||
|
|
||
| <div class="version-list" [class.hidden]="!isDropdownVisible()"> | ||
| <ul> | ||
| @for (version of previousVersions; track version.title) { | ||
| <li> | ||
| <a [href]="version.url"> | ||
| {{ version.title }} | ||
| </a> | ||
| </li> | ||
| } | ||
| </ul> | ||
| </div> | ||
| </div> | ||
| } | ||
| `, | ||
| styles: [ | ||
| ` | ||
| .version-toggle-btn { | ||
| width: 100%; | ||
| padding: 0.5rem 1rem; | ||
| background-color: #241b28; | ||
| color: #ffffffa3; | ||
| border: none; | ||
| cursor: pointer; | ||
| font-size: 0.9rem; | ||
| transition: background-color 0.2s ease; | ||
| display: flex; | ||
| justify-content: space-between; | ||
| align-items: center; | ||
| } | ||
|
|
||
| .arrow-icon { | ||
| display: inline-block; | ||
| transition: transform 0.3s ease; | ||
| font-size: 0.6rem; | ||
| } | ||
|
|
||
| .arrow-icon.rotated { | ||
| transform: rotate(180deg); | ||
| } | ||
|
|
||
| .version-toggle-btn:hover { | ||
| background-color: #2b1f31; | ||
| } | ||
|
|
||
| .version-list { | ||
| background-color: #0d0a0f; | ||
| } | ||
|
|
||
| .version-list.hidden { | ||
| display: none; | ||
| } | ||
|
|
||
| .version-list ul { | ||
| list-style: none; | ||
| padding: 0; | ||
| margin: 0; | ||
| } | ||
|
|
||
| .version-list li { | ||
| border-bottom: 1px solid #17111a; | ||
| font-size: 0.9rem; | ||
| } | ||
|
|
||
| .version-list li:last-child { | ||
| border-bottom: none; | ||
| } | ||
|
|
||
| .version-list a { | ||
| display: block; | ||
| padding: 0.25rem 1rem; | ||
| text-decoration: none; | ||
| color: #ffffffa3; | ||
| transition: background-color 0.2s ease; | ||
| } | ||
|
|
||
| .version-list a:hover { | ||
| background-color: #2b1f31; | ||
| } | ||
| `, | ||
| ], | ||
| host: { | ||
| '(document:click)': 'closeDropdownOnOutsideClick($event)', | ||
| }, | ||
| }) | ||
| export class VersionNavigationComponent { | ||
| readonly #versionInfoService = inject(VersionInfoService); | ||
| readonly #elementRef = inject(ElementRef); | ||
| readonly isDropdownVisible = signal(false); | ||
| readonly currentVersion = this.#versionInfoService.currentVersion; | ||
| readonly previousVersions = this.#versionInfoService.previousVersions; | ||
|
|
||
| closeDropdownOnOutsideClick(event: Event): void { | ||
| if (!this.#elementRef.nativeElement.contains(event.target as Node)) { | ||
| this.isDropdownVisible.set(false); | ||
| } | ||
| } | ||
|
|
||
| toggleDropdown(): void { | ||
| this.isDropdownVisible.update((visible) => !visible); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| { | ||
| "currentVersion": "21", | ||
| "docVersions": [ | ||
| { | ||
| "title": "v20", | ||
| "url": "https://v20.ngrx.io" | ||
| }, | ||
| { | ||
| "title": "v19", | ||
| "url": "https://v19.ngrx.io" | ||
| }, | ||
| { | ||
| "title": "v18", | ||
| "url": "https://v18.ngrx.io" | ||
| }, | ||
| { | ||
| "title": "v17", | ||
| "url": "https://v17.ngrx.io" | ||
| }, | ||
| { | ||
| "title": "v16", | ||
| "url": "https://v16.ngrx.io" | ||
| }, | ||
| { | ||
| "title": "v15", | ||
| "url": "https://v15.ngrx.io" | ||
| }, | ||
| { | ||
| "title": "v14", | ||
| "url": "https://v14.ngrx.io" | ||
| }, | ||
| { | ||
| "title": "v13", | ||
| "url": "https://v13.ngrx.io" | ||
| }, | ||
| { | ||
| "title": "v12", | ||
| "url": "https://v12.ngrx.io" | ||
| }, | ||
| { | ||
| "title": "v11", | ||
| "url": "https://v11.ngrx.io" | ||
| }, | ||
| { | ||
| "title": "v10", | ||
| "url": "https://v10.ngrx.io" | ||
| }, | ||
| { | ||
| "title": "v9", | ||
| "url": "https://v9.ngrx.io" | ||
| }, | ||
| { | ||
| "title": "v8", | ||
| "url": "https://v8.ngrx.io" | ||
| }, | ||
| { | ||
| "title": "v7", | ||
| "url": "https://v7.ngrx.io" | ||
| }, | ||
| { | ||
| "title": "v6", | ||
| "url": "https://github.com/ngrx/platform/tree/6.1.2/docs" | ||
| }, | ||
| { | ||
| "title": "v5", | ||
| "url": "https://github.com/ngrx/platform/tree/v5.2.0/docs" | ||
| }, | ||
| { | ||
| "title": "v4", | ||
| "url": "https://github.com/ngrx/platform/tree/v4.1.1/docs" | ||
| } | ||
| ] | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import { Injectable } from '@angular/core'; | ||
| import versionInfoData from '../data/versionInfo.json'; | ||
|
|
||
| interface PreviousVersion { | ||
| url: string; | ||
| title: string; | ||
| } | ||
|
|
||
| interface VersionInfo { | ||
| currentVersion: string; | ||
| docVersions: PreviousVersion[]; | ||
| } | ||
|
|
||
| @Injectable({ providedIn: 'root' }) | ||
| export class VersionInfoService { | ||
| readonly #versionInfo = versionInfoData as VersionInfo; | ||
| readonly currentVersion = this.#versionInfo.currentVersion; | ||
| readonly previousVersions = this.#versionInfo.docVersions; | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.