Skip to content

Commit

Permalink
refactor(toasts): improve a11y and code quality based on sonar findings
Browse files Browse the repository at this point in the history
  • Loading branch information
svierk committed Oct 19, 2024
1 parent dded929 commit 838d674
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
<app-toaster></app-toaster>

<!-- Toolbar -->
<div class="toolbar" role="banner">
<header class="toolbar">
<img
width="40"
alt="Angular Logo"
src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTAgMjUwIj4KICAgIDxwYXRoIGZpbGw9IiNERDAwMzEiIGQ9Ik0xMjUgMzBMMzEuOSA2My4ybDE0LjIgMTIzLjFMMTI1IDIzMGw3OC45LTQzLjcgMTQuMi0xMjMuMXoiIC8+CiAgICA8cGF0aCBmaWxsPSIjQzMwMDJGIiBkPSJNMTI1IDMwdjIyLjItLjFWMjMwbDc4LjktNDMuNyAxNC4yLTEyMy4xTDEyNSAzMHoiIC8+CiAgICA8cGF0aCAgZmlsbD0iI0ZGRkZGRiIgZD0iTTEyNSA1Mi4xTDY2LjggMTgyLjZoMjEuN2wxMS43LTI5LjJoNDkuNGwxMS43IDI5LjJIMTgzTDEyNSA1Mi4xem0xNyA4My4zaC0zNGwxNy00MC45IDE3IDQwLjl6IiAvPgogIDwvc3ZnPg=="
/>
<span>Welcome</span>
</div>
</header>

<div class="content" role="main">
<main class="content">
<!-- Highlight Card -->
<div class="card highlight-card card-small">
<svg id="rocket" xmlns="http://www.w3.org/2000/svg" width="101.678" height="101.678" viewBox="0 0 101.678 101.678">
Expand Down Expand Up @@ -87,6 +87,6 @@ <h2>Toasts</h2>
fill="#eee"
/>
</svg>
</div>
</main>

<router-outlet></router-outlet>
2 changes: 1 addition & 1 deletion src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class AppComponent {

EventTypes = EventTypes;

constructor(private toastService: ToastService) {}
constructor(readonly toastService: ToastService) {}

showToast(type: EventTypes) {
switch (type) {
Expand Down
4 changes: 2 additions & 2 deletions src/app/components/toaster/toaster.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ export class ToasterComponent implements OnInit {
currentToasts: ToastEvent[] = [];

constructor(
private toastService: ToastService,
private cdr: ChangeDetectorRef
readonly toastService: ToastService,
readonly cdr: ChangeDetectorRef
) {}

ngOnInit() {
Expand Down
2 changes: 1 addition & 1 deletion src/app/services/toast.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ToastEvent } from '../models/toast-event';
})
export class ToastService {
toastEvents: Observable<ToastEvent>;
private _toastEvents = new Subject<ToastEvent>();
readonly _toastEvents = new Subject<ToastEvent>();

constructor() {
this.toastEvents = this._toastEvents.asObservable();
Expand Down

0 comments on commit 838d674

Please sign in to comment.