@@ -5,7 +5,7 @@ import { Component, Input, OnInit } from '@angular/core';
5
5
selector : 'network-status' ,
6
6
template : `
7
7
<div
8
- *ngIf="showNetworkStatus "
8
+ *ngIf="networkStatus "
9
9
@showHideNotification
10
10
aria-live="assertive"
11
11
class="pointer-events-none fixed inset-0 flex items-end px-4 py-6 sm:p-6">
@@ -14,52 +14,51 @@ import { Component, Input, OnInit } from '@angular/core';
14
14
class="pointer-events-auto w-full max-w-sm overflow-hidden rounded-lg bg-white dark:bg-gray-800 shadow-lg ring-1 ring-black ring-opacity-5">
15
15
<div class="p-4">
16
16
<div class="flex items-start">
17
- <div class="flex-shrink-0">
18
- <!-- Heroicon name: outline/check-circle -->
17
+ <div class="shrink-0">
19
18
<svg
20
- class="h-6 w-6 text-green-400"
21
- xmlns="http://www.w3.org/2000/svg"
19
+ class="h-6 w-6"
20
+ [class.text-red-400]="networkStatus === 'offline'"
21
+ [class.text-green-400]="networkStatus === 'online'"
22
22
fill="none"
23
23
viewBox="0 0 24 24"
24
24
stroke-width="1.5"
25
25
stroke="currentColor"
26
+ xmlns="http://www.w3.org/2000/svg"
27
+ viewBox="0 0 24 24"
26
28
aria-hidden="true">
27
29
<path
30
+ *ngIf="networkStatus === 'online'"
28
31
stroke-linecap="round"
29
32
stroke-linejoin="round"
30
33
d="M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
34
+ <path
35
+ *ngIf="networkStatus === 'offline'"
36
+ d="M15.312 10c1.368.426 2.65 1.12 3.768 2.05m3.5-3.55a16 16 0 0 0-12.383-3.896M8.53 15.61a6 6 0 0 1 6.95 0M12 19.5h.01M1.193 8.7A16.014 16.014 0 0 1 5.76 5.764m-1.027 6.48a10.966 10.966 0 0 1 5-2.51m5.966 6.042A5.974 5.974 0 0 0 12 14.5c-1.416 0-2.718.49-3.745 1.312M3 3l18 18"
37
+ stroke-linecap="round"
38
+ stroke-linejoin="round" />
31
39
</svg>
32
40
</div>
33
41
<div class="ml-3 w-0 flex-1 pt-0.5">
34
42
<p class="text-sm font-medium text-slate-900 capitalize">
35
- Online
43
+ {{ networkStatus }}
36
44
</p>
37
45
<p class="mt-1 text-sm text-slate-500">
38
- Anyone with a link can now view this file.
46
+ {{ networkStatusMessage }}
39
47
</p>
40
48
</div>
41
49
</div>
42
50
</div>
43
51
</div>
44
52
</div>
45
53
</div>
46
- <div *ngIf="networkStatus === 'online'" class="online">
47
- <span>{{ networkStatusMessage }}</span>
48
- </div>
49
-
50
- <div *ngIf="networkStatus === 'offline'" class="offline">
51
- <span>{{ networkStatusMessage }}</span>
52
- </div>
53
54
` ,
54
55
animations : [
55
56
trigger ( 'showHideNotification' , [
56
57
transition ( 'void => *' , [
57
- style ( { transform : " translateX(0.5rem)" , opacity : 0 } ) ,
58
- animate ( 300 , style ( { transform : " translateX(0)" , opacity : 1 } ) )
58
+ style ( { transform : ' translateX(0.5rem)' , opacity : 0 } ) ,
59
+ animate ( 300 , style ( { transform : ' translateX(0)' , opacity : 1 } ) ) ,
59
60
] ) ,
60
- transition ( '* => void' , [
61
- animate ( 100 , style ( { opacity : 0 } ) )
62
- ] )
61
+ transition ( '* => void' , [ animate ( 100 , style ( { opacity : 0 } ) ) ] ) ,
63
62
] ) ,
64
63
] ,
65
64
} )
@@ -72,6 +71,6 @@ export class NetworkStatusComponent implements OnInit {
72
71
ngOnInit ( ) {
73
72
setTimeout ( ( ) => {
74
73
this . showNetworkStatus = false ;
75
- } , 3000 ) ;
74
+ } , 100 ) ;
76
75
}
77
76
}
0 commit comments