-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
191 additions
and
77 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
.../app/examples/custom-default-loading-example/custom-default-loading-example.component.css
This file contains 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,16 @@ | ||
.loadables { | ||
display: grid; | ||
grid-template-columns: repeat(2, 1fr); | ||
gap: 50px; | ||
} | ||
|
||
:host { | ||
display: grid; | ||
grid-template-areas: "main aside"; | ||
grid-template-columns: auto 500px; | ||
gap: 30px; | ||
} | ||
|
||
aside { | ||
grid-area: "aside"; | ||
} |
30 changes: 19 additions & 11 deletions
30
...app/examples/custom-default-loading-example/custom-default-loading-example.component.html
This file contains 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 |
---|---|---|
@@ -1,11 +1,19 @@ | ||
<h2>Custom default loading template</h2> | ||
<p> | ||
This example displays the usage of the `ld-loadable` component with a loading | ||
component that is registered as a default for all `ld-loadable` components in | ||
that module. | ||
</p> | ||
<app-load-form (loadable)="loadable = $event"></app-load-form> | ||
<ld-loadable [loadable]="loadable"> | ||
<h3>Loaded</h3> | ||
<pre>{{ loadable | loadedValue | json }}</pre> | ||
</ld-loadable> | ||
<div class="main"> | ||
<h2>Custom default loading template</h2> | ||
<p> | ||
This example displays the usage of the `ld-loadable` component with a | ||
loading component that is registered as a default for all `ld-loadable` | ||
components in that module. | ||
</p> | ||
<app-load-form (loadable)="loadable = $event"></app-load-form> | ||
<ld-loadable [loadable]="loadable"> | ||
<h3>Loaded</h3> | ||
<pre>{{ loadable | loadedValue | json }}</pre> | ||
</ld-loadable> | ||
</div> | ||
<aside> | ||
<div> | ||
<h3>State of the loadable</h3> | ||
<pre>{{ loadable | json }}</pre> | ||
</div> | ||
</aside> |
This file contains 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
This file contains 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
50 changes: 27 additions & 23 deletions
50
...p/examples/custom-loading-template-example/custom-loading-template-example.component.html
This file contains 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 |
---|---|---|
@@ -1,24 +1,28 @@ | ||
<h2>Custom loading template</h2> | ||
<p> | ||
This example displays the usage of the `ld-loadable` component with a custom | ||
loading template. The left loadable uses the custom loading template while the | ||
right component uses the default. | ||
</p> | ||
<app-load-form (loadable)="loadable = $event"></app-load-form> | ||
<div> | ||
<h3>State of the loadable</h3> | ||
<pre>{{ loadable | json }}</pre> | ||
</div> | ||
<div class="loadables"> | ||
<ld-loadable [loadable]="loadable" [templates]="{ loading: loading }"> | ||
<h3>Loaded</h3> | ||
<pre>{{ loadable | loadedValue | json }}</pre> | ||
</ld-loadable> | ||
<ng-template #loading> | ||
<p>The answer is currently being computed.</p> | ||
</ng-template> | ||
<ld-loadable [loadable]="loadable"> | ||
<h3>Loaded</h3> | ||
<pre>{{ loadable | loadedValue | json }}</pre> | ||
</ld-loadable> | ||
<div class="main"> | ||
<h2>Custom loading template</h2> | ||
<p> | ||
This example displays the usage of the `ld-loadable` component with a custom | ||
loading template. The left loadable uses the custom loading template while | ||
the right component uses the default. | ||
</p> | ||
<app-load-form (loadable)="loadable = $event"></app-load-form> | ||
<div class="loadables"> | ||
<ld-loadable [loadable]="loadable" [templates]="{ loading: loading }"> | ||
<h3>Loaded</h3> | ||
<pre>{{ loadable | loadedValue | json }}</pre> | ||
</ld-loadable> | ||
<ng-template #loading> | ||
<p>The answer is currently being computed.</p> | ||
</ng-template> | ||
<ld-loadable [loadable]="loadable"> | ||
<h3>Loaded</h3> | ||
<pre>{{ loadable | loadedValue | json }}</pre> | ||
</ld-loadable> | ||
</div> | ||
</div> | ||
<aside> | ||
<div> | ||
<h3>State of the loadable</h3> | ||
<pre>{{ loadable | json }}</pre> | ||
</div> | ||
</aside> |
16 changes: 16 additions & 0 deletions
16
projects/example-app/src/app/examples/default-example/default-example.component.css
This file contains 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,16 @@ | ||
.loadables { | ||
display: grid; | ||
grid-template-columns: repeat(2, 1fr); | ||
gap: 50px; | ||
} | ||
|
||
:host { | ||
display: grid; | ||
grid-template-areas: "main aside"; | ||
grid-template-columns: auto 500px; | ||
gap: 30px; | ||
} | ||
|
||
aside { | ||
grid-area: "aside"; | ||
} |
34 changes: 21 additions & 13 deletions
34
projects/example-app/src/app/examples/default-example/default-example.component.html
This file contains 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 |
---|---|---|
@@ -1,14 +1,22 @@ | ||
<h2>Default usage example</h2> | ||
<p> | ||
This examples displays the default usage of the `ld-loadable` component. The | ||
`LoadableModule` is imported with the default loading and error components. | ||
</p> | ||
<app-load-form (loadable)="loadable = $event"></app-load-form> | ||
<div> | ||
<h3>State of the loadable</h3> | ||
<pre>{{ loadable | json }}</pre> | ||
<div class="main"> | ||
<h2>Default usage example</h2> | ||
<p> | ||
This examples displays the default usage of the `ld-loadable` component. The | ||
`LoadableModule` is imported with the default loading and error components. | ||
</p> | ||
<app-load-form (loadable)="loadable = $event"></app-load-form> | ||
<div> | ||
<h3>State of the loadable</h3> | ||
<pre>{{ loadable | json }}</pre> | ||
</div> | ||
<ld-loadable [loadable]="loadable"> | ||
<h3>Loaded</h3> | ||
<pre>{{ loadable | loadedValue | json }}</pre> | ||
</ld-loadable> | ||
</div> | ||
<ld-loadable [loadable]="loadable"> | ||
<h3>Loaded</h3> | ||
<pre>{{ loadable | loadedValue | json }}</pre> | ||
</ld-loadable> | ||
<aside> | ||
<div> | ||
<h3>State of the loadable</h3> | ||
<pre>{{ loadable | json }}</pre> | ||
</div> | ||
</aside> |
This file contains 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
16 changes: 16 additions & 0 deletions
16
projects/example-app/src/app/examples/lightweight-example/lightweight-example.component.css
This file contains 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,16 @@ | ||
.loadables { | ||
display: grid; | ||
grid-template-columns: repeat(2, 1fr); | ||
gap: 50px; | ||
} | ||
|
||
:host { | ||
display: grid; | ||
grid-template-areas: "main aside"; | ||
grid-template-columns: auto 500px; | ||
gap: 30px; | ||
} | ||
|
||
aside { | ||
grid-area: "aside"; | ||
} |
42 changes: 25 additions & 17 deletions
42
projects/example-app/src/app/examples/lightweight-example/lightweight-example.component.html
This file contains 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 |
---|---|---|
@@ -1,18 +1,26 @@ | ||
<h2>Lightweight example</h2> | ||
<p> | ||
This example displays the usage of the loadable type in Angular components | ||
without the usage of the `ld-loadable` component. This might be useful if you | ||
need more control over the display of the loadable object. | ||
</p> | ||
<app-load-form (loadable)="loadable = $event"></app-load-form> | ||
<ng-container [ngSwitch]="loadable | loadingState"> | ||
<ld-loadable-loading *ngSwitchCase="'loading'"></ld-loadable-loading> | ||
<div *ngSwitchCase="'loaded'"> | ||
<h3>Loaded</h3> | ||
<pre>{{ loadable | loadedValue | json }}</pre> | ||
<div class="main"> | ||
<h2>Lightweight example</h2> | ||
<p> | ||
This example displays the usage of the loadable type in Angular components | ||
without the usage of the `ld-loadable` component. This might be useful if | ||
you need more control over the display of the loadable object. | ||
</p> | ||
<app-load-form (loadable)="loadable = $event"></app-load-form> | ||
<ng-container [ngSwitch]="loadable | loadingState"> | ||
<ld-loadable-loading *ngSwitchCase="'loading'"></ld-loadable-loading> | ||
<div *ngSwitchCase="'loaded'"> | ||
<h3>Loaded</h3> | ||
<pre>{{ loadable | loadedValue | json }}</pre> | ||
</div> | ||
<ld-loadable-error | ||
*ngSwitchCase="'error'" | ||
[error]="loadable.error" | ||
></ld-loadable-error> | ||
</ng-container> | ||
</div> | ||
<aside> | ||
<div> | ||
<h3>State of the loadable</h3> | ||
<pre>{{ loadable | json }}</pre> | ||
</div> | ||
<ld-loadable-error | ||
*ngSwitchCase="'error'" | ||
[error]="loadable.error" | ||
></ld-loadable-error> | ||
</ng-container> | ||
</aside> |
This file contains 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
16 changes: 16 additions & 0 deletions
16
projects/example-app/src/app/examples/ngrx-example/ngrx-example.component.css
This file contains 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,16 @@ | ||
.loadables { | ||
display: grid; | ||
grid-template-columns: repeat(2, 1fr); | ||
gap: 50px; | ||
} | ||
|
||
:host { | ||
display: grid; | ||
grid-template-areas: "main aside"; | ||
grid-template-columns: auto 500px; | ||
gap: 30px; | ||
} | ||
|
||
aside { | ||
grid-area: "aside"; | ||
} |
30 changes: 19 additions & 11 deletions
30
projects/example-app/src/app/examples/ngrx-example/ngrx-example.component.html
This file contains 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 |
---|---|---|
@@ -1,11 +1,19 @@ | ||
<h2>NgRx</h2> | ||
<p> | ||
This example displays how objects of the loadable type can be stored with | ||
NgRx. | ||
</p> | ||
<button (click)="load(42, false)">Load</button> | ||
<button (click)="load(42, true)">Load with error</button> | ||
<ld-loadable *ngIf="loadable$ | async as loadable" [loadable]="loadable"> | ||
<h3>Loaded</h3> | ||
<pre>{{ loadable.value | json }}</pre> | ||
</ld-loadable> | ||
<div class="main"> | ||
<h2>NgRx</h2> | ||
<p> | ||
This example displays how objects of the loadable type can be stored with | ||
NgRx. | ||
</p> | ||
<button (click)="load(42, false)">Load</button> | ||
<button (click)="load(42, true)">Load with error</button> | ||
<ld-loadable *ngIf="loadable$ | async as loadable" [loadable]="loadable"> | ||
<h3>Loaded</h3> | ||
<pre>{{ loadable.value | json }}</pre> | ||
</ld-loadable> | ||
</div> | ||
<aside> | ||
<div> | ||
<h3>State of the loadable</h3> | ||
<pre>{{ loadable$ | async | json }}</pre> | ||
</div> | ||
</aside> |
This file contains 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
This file contains 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