Skip to content

Commit eb7046e

Browse files
authored
Merge pull request #363 from NickPhura/ACRFD-13-2
ACRFD-13-2: FIx wonky IE spinner.
2 parents 1791638 + 757ebc8 commit eb7046e

File tree

6 files changed

+35
-5
lines changed

6 files changed

+35
-5
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
"mygovbc-bootstrap-theme": "0.4.1",
4848
"ng2-bootstrap-modal": "1.0.1",
4949
"ngx-pagination": "3.2.1",
50+
"ng-inline-svg": "8.5.1",
5051
"rxjs": "6.5.2",
5152
"web-animations-js": "2.3.1",
5253
"xlsx": "0.14.3",

src/app/applications/application-detail/application-detail.component.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ <h1>Crown land File: {{application.clFile}}</h1>
3636
<button class="btn btn-icon" title="Refresh this application with the latest data from Tantalis"
3737
(click)="refreshApplication()"
3838
[disabled]="isRefreshing">
39-
<i class="material-icons" [ngClass]="{'rotating': isRefreshing}">
40-
refresh
39+
<i class="material-icons refresh-spinner" [ngClass]="{'rotating': isRefreshing}" [inlineSVG]="'assets/images/baseline-refresh-24px.svg'">
4140
</i>
4241
</button>
4342
<span class="vert-pipe">&nbsp;</span>

src/app/applications/application-detail/application-detail.component.scss

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,3 +174,30 @@ ngb-alert {
174174
left: 50%;
175175
margin-left: -6rem;
176176
}
177+
178+
// This, plus the use of the inlineSVG directive, is all because IE renders material icons poorly (IE renders the
179+
// icons asymmetrically, so spinners rotate super wonky). This entire chunk of scss and the inlineSVG directive
180+
// could be replaced with the regular use of material icons if IE rendered the icons correctly. See other material-icon
181+
// <i> tags for examples.
182+
.btn {
183+
&:hover .refresh-spinner > ::ng-deep svg {
184+
fill: #212529;
185+
}
186+
187+
.refresh-spinner {
188+
height: 24px;
189+
width: 24px;
190+
-webkit-transition: background-color 0.15s ease-in-out;
191+
-moz-transition: background-color 0.15s ease-in-out;
192+
-ms-transition: background-color 0.15s ease-in-out;
193+
-o-transition: background-color 0.15s ease-in-out;
194+
transition: background-color 0.15s ease-in-out;
195+
196+
// Because the element is loaded dynamically, we need to use ng-deep to force the css to apply
197+
> ::ng-deep svg {
198+
display: block;
199+
margin: auto;
200+
fill: #808080;
201+
}
202+
}
203+
}

src/app/applications/applications.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { SharedModule } from 'app/shared.module';
66
import { NgxPaginationModule } from 'ngx-pagination';
77
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
88
import { ApplicationsRoutingModule } from './applications-routing.module';
9+
import { InlineSVGModule } from 'ng-inline-svg';
910

1011
// components
1112
import { ApplicationListComponent } from './application-list/application-list.component';
@@ -27,6 +28,7 @@ import { ExcelService } from 'app/services/excel.service';
2728
SharedModule,
2829
NgxPaginationModule,
2930
NgbModule.forRoot(),
31+
InlineSVGModule.forRoot(),
3032
ApplicationsRoutingModule
3133
],
3234
declarations: [

src/app/utils/token-interceptor.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http';
22
import { Injectable } from '@angular/core';
33
import { KeycloakService } from 'app/services/keycloak.service';
4-
import { Observable, Subject } from 'rxjs';
4+
import { Observable, Subject, throwError } from 'rxjs';
55
import { catchError, switchMap, tap } from 'rxjs/operators';
66

77
/**
@@ -42,11 +42,11 @@ export class TokenInterceptor implements HttpInterceptor {
4242
return next.handle(request);
4343
}),
4444
catchError(err => {
45-
return Observable.throw(err);
45+
return throwError(err);
4646
})
4747
);
4848
}
49-
return Observable.throw(error);
49+
return throwError(error);
5050
})
5151
);
5252
}
Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)