Skip to content

Commit 00c78cc

Browse files
committed
wip
1 parent 4b73216 commit 00c78cc

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

src/app/core/components/network-status/network-status.component.ts

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
import { Component, Input } from '@angular/core';
1+
import { animate, style, transition, trigger } from '@angular/animations';
2+
import { Component, Input, OnInit } from '@angular/core';
23

34
@Component({
45
selector: 'network-status',
56
template: `
67
<div
8+
*ngIf="showNetworkStatus"
9+
@showHideNotification
710
aria-live="assertive"
811
class="pointer-events-none fixed inset-0 flex items-end px-4 py-6 sm:p-6">
912
<div class="flex w-full flex-col items-end space-y-4">
@@ -48,8 +51,27 @@ import { Component, Input } from '@angular/core';
4851
<span>{{ networkStatusMessage }}</span>
4952
</div>
5053
`,
54+
animations: [
55+
trigger('showHideNotification', [
56+
transition('void => *', [
57+
style({ transform: "translateX(0.5rem)", opacity: 0 }),
58+
animate(300, style({ transform: "translateX(0)", opacity: 1 }))
59+
]),
60+
transition('* => void', [
61+
animate(100, style({ opacity: 0 }))
62+
])
63+
]),
64+
],
5165
})
52-
export class NetworkStatusComponent {
66+
export class NetworkStatusComponent implements OnInit {
5367
@Input() networkStatusMessage!: string;
5468
@Input() networkStatus!: string;
69+
70+
showNetworkStatus: boolean = true;
71+
72+
ngOnInit() {
73+
setTimeout(() => {
74+
this.showNetworkStatus = false;
75+
}, 3000);
76+
}
5577
}

0 commit comments

Comments
 (0)