Skip to content

Commit 021a9e6

Browse files
docs(www): update content and navigation (#4875)
1 parent 80584ee commit 021a9e6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1530
-484
lines changed

projects/ngrx.io/content/guide/store/action-groups.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@
22

33
<div class="video-container">
44
<div class="video-responsive-wrapper">
5-
65
<iframe
76
src="https://www.youtube.com/embed/rk83ZMqEDV4"
87
allow="accelerometer; encrypted-media; gyroscope; picture-in-picture"
98
allowfullscreen
109
frameborder="0"
1110
></iframe>
12-
1311
</div>
1412
</div>
1513

projects/ngrx.io/content/guide/store/feature-creators.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Feature Creators
2+
23
<div class="video-container">
34
<div class="video-responsive-wrapper">
45
<iframe

projects/ngrx.io/content/marketing/contributing.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,12 @@ Watch as Brandon Roberts and Jan-Niklas Wortmann walk through how to contribute
1414

1515
<div class="video-container">
1616
<div class="video-responsive-wrapper">
17-
1817
<iframe
1918
src="https://www.youtube.com/embed/ug0c1tUegm4"
2019
allow="accelerometer; encrypted-media; gyroscope; picture-in-picture"
2120
allowfullscreen
2221
frameborder="0"
2322
></iframe>
24-
2523
</div>
2624
</div>
2725

projects/www/src/app/pages/guide/component-store/effect.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ To make this possible set the generic type of the `effect` method to `void`.
9999
<ngrx-code-example header="movies.store.ts">
100100

101101
```ts
102-
readonly getAllMovies = this.effect<void>(
102+
readonly getAllMovies = this.effect<void>(
103103
// The name of the source stream doesn't matter: `trigger$`, `source$` or `$` are good
104104
// names. We encourage to choose one of these and use them consistently in your codebase.
105105
(trigger$) => trigger$.pipe(

projects/www/src/app/pages/guide/component-store/read.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ The `select` method accepts a dictionary of observables as input and returns an
9898
<ngrx-code-example header="movies.store.ts">
9999

100100
```ts
101-
private readonly vm$ = this.select({
101+
private readonly vm$ = this.select({
102102
movies: this.movies$,
103103
userPreferredMovieIds: this.userPreferredMovieIds$,
104104
userPreferredMovies: this.userPreferredMovies$

projects/www/src/app/pages/guide/component-store/usage.md

Lines changed: 76 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,16 @@ Below are the steps of integrating `ComponentStore` into a component.
9999

100100
First, the state for the component needs to be identified. In `SlideToggleComponent` only the state of whether the toggle is turned ON or OFF is stored.
101101

102-
<ngrx-code-example header="src/app/slide-toggle.component.ts"
102+
<ngrx-code-example
103+
header="src/app/slide-toggle.component.ts"
103104
path="component-store-slide-toggle/src/app/slide-toggle.component.ts"
104105
region="state">
105106

106-
`ts`
107+
```ts
108+
export interface SlideToggleState {
109+
checked: boolean;
110+
}
111+
```
107112

108113
</ngrx-code-example>
109114

@@ -120,7 +125,11 @@ In this example `ComponentStore` is provided directly in the component. This wor
120125
path="component-store-slide-toggle/src/app/slide-toggle.component.ts"
121126
region="providers">
122127

123-
`ts`
128+
```ts
129+
@Component({
130+
selector: 'mat-slide-toggle',
131+
templateUrl: 'slide-toggle.html',
132+
```
124133
125134
</ngrx-code-example>
126135
@@ -138,11 +147,21 @@ When it is called with a callback, the state is updated.
138147
139148
</ngrx-docs-alert>
140149
141-
<ngrx-code-example header="src/app/slide-toggle.component.ts"
150+
<ngrx-code-example
151+
header="src/app/slide-toggle.component.ts"
142152
path="component-store-slide-toggle/src/app/slide-toggle.component.ts"
143153
region="init">
144154
145-
`ts`
155+
```ts
156+
constructor(
157+
private readonly componentStore: ComponentStore<SlideToggleState>
158+
) {
159+
// set defaults
160+
this.componentStore.setState({
161+
checked: false,
162+
});
163+
}
164+
```
146165
147166
</ngrx-code-example>
148167
@@ -159,7 +178,11 @@ When a user clicks the toggle (triggering a 'change' event), instead of calling
159178
path="component-store-slide-toggle/src/app/slide-toggle.component.ts"
160179
region="updater">
161180
162-
`ts`
181+
```ts
182+
@Input() set checked(value: boolean) {
183+
this.setChecked(value);
184+
}
185+
```
163186
164187
</ngrx-code-example>
165188
@@ -170,11 +193,18 @@ Finally, the state is aggregated with selectors into two properties:
170193
- `vm$` property collects all the data needed for the template - this is the _ViewModel_ of `SlideToggleComponent`.
171194
- `change` is the `@Output` of `SlideToggleComponent`. Instead of creating an `EventEmitter`, here the output is connected to the Observable source directly.
172195
173-
<ngrx-code-example header="src/app/slide-toggle.component.ts"
196+
<ngrx-code-example
197+
header="src/app/slide-toggle.component.ts"
174198
path="component-store-slide-toggle/src/app/slide-toggle.component.ts"
175199
region="selector">
176200
177-
`ts`
201+
```ts
202+
// Observable<MatSlideToggleChange> used instead of EventEmitter
203+
@Output() readonly change = this.componentStore.select((state) => ({
204+
source: this,
205+
checked: state.checked,
206+
}));
207+
```
178208
179209
</ngrx-code-example>
180210
@@ -228,23 +258,57 @@ You can see the examples at StackBlitz:
228258
229259
With `ComponentStore` extracted into `PaginatorStore`, the developer is now using updaters and effects to update the state. `@Input` values are passed directly into `updater`s as their arguments.
230260
231-
<ngrx-code-example header="src/app/paginator.store.ts"
261+
<ngrx-code-example
262+
header="src/app/paginator.store.ts"
232263
path="component-store-paginator-service/src/app/paginator.component.ts"
233264
region="inputs">
234265
235-
`ts`
266+
```ts
267+
@Input() set pageIndex(value: string | number) {
268+
this.paginatorStore.setPageIndex(value);
269+
}
270+
271+
@Input() set length(value: string | number) {
272+
this.paginatorStore.setLength(value);
273+
}
274+
275+
@Input() set pageSize(value: string | number) {
276+
this.paginatorStore.setPageSize(value);
277+
}
278+
279+
@Input() set pageSizeOptions(value: readonly number[]) {
280+
this.paginatorStore.setPageSizeOptions(value);
281+
}
282+
```
236283
237284
</ngrx-code-example>
238285
239286
Not all `updater`s have to be called in the `@Input`. For example, `changePageSize` is called from the template.
240287
241288
Effects are used to perform additional validation and get extra information from sources with derived data (i.e. selectors).
242289
243-
<ngrx-code-example header="src/app/paginator.store.ts"
290+
<ngrx-code-example
291+
header="src/app/paginator.store.ts"
244292
path="component-store-paginator-service/src/app/paginator.component.ts"
245293
region="updating-state">
246294
247-
`ts`
295+
```ts
296+
changePageSize(newPageSize: number) {
297+
this.paginatorStore.changePageSize(newPageSize);
298+
}
299+
nextPage() {
300+
this.paginatorStore.nextPage();
301+
}
302+
firstPage() {
303+
this.paginatorStore.firstPage();
304+
}
305+
previousPage() {
306+
this.paginatorStore.previousPage();
307+
}
308+
lastPage() {
309+
this.paginatorStore.lastPage();
310+
}
311+
```
248312
249313
</ngrx-code-example>
250314

projects/www/src/app/pages/guide/component/index.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
<ngrx-docs-alert type="error">
2+
3+
The `@ngrx/component` package is in <a href="https://github.com/ngrx/platform/issues/4872" target="_blank">maintenance mode</a>.
4+
Changes to this package are limited to critical bug fixes.
5+
6+
</ngrx-docs-alert>
7+
18
# @ngrx/component
29

310
Component is a library for building reactive Angular templates.

projects/www/src/app/pages/guide/component/install.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
<ngrx-docs-alert type="error">
2+
3+
The `@ngrx/component` package is in <a href="https://github.com/ngrx/platform/issues/4872" target="_blank">maintenance mode</a>.
4+
Changes to this package are limited to critical bug fixes.
5+
6+
</ngrx-docs-alert>
7+
18
# Installation
29

310
## Installing with `ng add`

projects/www/src/app/pages/guide/component/let.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
<ngrx-docs-alert type="error">
2+
3+
The `@ngrx/component` package is in <a href="https://github.com/ngrx/platform/issues/4872" target="_blank">maintenance mode</a>.
4+
Changes to this package are limited to critical bug fixes.
5+
6+
</ngrx-docs-alert>
7+
18
# Let Directive
29

310
The `*ngrxLet` directive serves a convenient way of binding observables to a view context

projects/www/src/app/pages/guide/component/push.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
<ngrx-docs-alert type="error">
2+
3+
The `@ngrx/component` package is in <a href="https://github.com/ngrx/platform/issues/4872" target="_blank">maintenance mode</a>.
4+
Changes to this package are limited to critical bug fixes.
5+
6+
</ngrx-docs-alert>
7+
18
# Push Pipe
29

310
The `ngrxPush` pipe serves as a drop-in replacement for the `async` pipe.

0 commit comments

Comments
 (0)