Skip to content
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

docs(playground): 📘 use spinners instead of loading text #127

Merged
merged 3 commits into from
Nov 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/app/basic-page/todos-page.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@ <h1>Basic Example</h1>
<h3>Signal Result</h3>
<blockquote>
@if (todos();as result) { @if (result.isLoading) {
<p>Loading</p>
<span class="loader"></span>
} @if (result.isSuccess) {
<p>{{ result.data[0].title }}</p>
<p>{{ result.data[0].title }}</p>
} @if (result.isError) {
<p>Error</p>
<p>Error</p>
} }
</blockquote>

<h3>Observable Result</h3>

<blockquote>
@if (todosResult.result$ | async;as result) { @if (result.isLoading) {
<p>Loading</p>
<span class="loader"></span>
} @if (result.isSuccess) {
<p>{{ result.data[0].title }}</p>
<p>{{ result.data[0].title }}</p>
} @if (result.isError) {
<p>Error</p>
<p>Error</p>
} }
</blockquote>
</div>
39 changes: 13 additions & 26 deletions src/app/infinite-scroll-page/posts-page.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,18 @@ <h1>Infinite Loading Example</h1>
</div>

@if (posts$ | async;as result) {
<p *ngIf="result.isPending">Loading...</p>

<span *ngIf="result.isError">Error: {{ result.error.message }}</span>
@if (result.isError) {
<div class="notification is-danger">
Error: {{ result.error.message }}
</div>
}

<div class="pagination">
<div class="pagination-list">
{{
result.isFetching && !result.isFetchingNextPage
? 'Background Updating...'
: ''
}}
@if ((result.isFetching && !result.isFetchingNextPage) || result.isPending) {
<span class="loader"></span>
}
</div>
<button
class="pagination-previous button is-primary"
Expand All @@ -34,13 +35,7 @@ <h1>Infinite Loading Example</h1>
(click)="result.fetchPreviousPage()"
[disabled]="!result.hasPreviousPage || result.isFetchingPreviousPage"
>
{{
result.isFetchingPreviousPage
? 'Loading more...'
: result.hasPreviousPage
? 'Load Older'
: 'Nothing more to load'
}}
Load Older
</button>
</div>

Expand Down Expand Up @@ -75,11 +70,9 @@ <h1>Infinite Loading Example</h1>

<div class="pagination">
<div class="pagination-list">
{{
result.isFetching && !result.isFetchingNextPage
? 'Background Updating...'
: ''
}}
@if ((result.isFetching && !result.isFetchingNextPage) || result.isPending) {
<span class="loader"></span>
}
</div>
<button
queryInView
Expand All @@ -89,13 +82,7 @@ <h1>Infinite Loading Example</h1>
(click)="result.fetchNextPage()"
[disabled]="!result.hasNextPage || result.isFetchingNextPage"
>
{{
result.isFetchingNextPage
? 'Loading more...'
: result.hasNextPage
? 'Load Newer'
: 'Nothing more to load'
}}
Load Newer
</button>
</div>
}
4 changes: 2 additions & 2 deletions src/app/intersecting-page/intersecting-page.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h3>Signal Result</h3>

<blockquote>
@if(intersection(); as intersectionResult) { @if(intersectionResult.isLoading) {
<p>Loading</p>
<span class="loader"></span>
} @if(intersectionResult.isSuccess) {
<p>{{ intersectionResult.data }}</p>
} @if(intersectionResult.isError) {
Expand All @@ -34,7 +34,7 @@ <h3>Observable Result</h3>

<blockquote>
@if(intersection$ | async; as intersectionResult) { @if(intersectionResult.isLoading) {
<p>Loading</p>
<span class="loader"></span>
} @if(intersectionResult.isSuccess) {
<p>{{ intersectionResult.data }}</p>
} @if(intersectionResult.isError) {
Expand Down
4 changes: 3 additions & 1 deletion src/app/pagination-page/pagination-page.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ <h1>Pagination Example</h1>
Previous
</button>
<div class="pagination-list">
<p>{{ projects.isFetching ? 'Loading...' : '' }}</p>
@if (projects.isFetching) {
<span class="loader"></span>
}
</div>
<button
class="pagination-next button"
Expand Down
5 changes: 5 additions & 0 deletions src/styles.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* You can add global styles to this file, and also import other style files */
@import "bulma";

body {
background-color: #F2F6FA;
Expand All @@ -21,4 +22,8 @@ body {
.is-primary-button {
background-color: #AE08E4 !important;
color: #fff !important;
}

.loader {
@include loader;
}