File tree 1 file changed +46
-23
lines changed
1 file changed +46
-23
lines changed Original file line number Diff line number Diff line change 1
1
<script >
2
- import { dev } from ' $app/environment' ;
3
2
import { page } from ' $app/stores' ;
3
+ // we don't want to use <svelte:window bind:online> here, because we only care about the online
4
+ // state when the page first loads
5
+ let online = typeof navigator !== ' undefined' ? navigator .onLine : true ;
4
6
</script >
5
7
6
- <div class = " error " >
7
- <div class = " content " >
8
- < h1 >{ $page . status }</ h1 >
8
+ <svelte:head >
9
+ <title >{ $page . status }</ title >
10
+ </ svelte:head >
9
11
10
- {#if dev && $page .error }
11
- <pre >{$page .error .stack }</pre >
12
+ <div class =" container" >
13
+ {#if $page .status === 404 }
14
+ <h1 >Not found!</h1 >
15
+ {:else if online }
16
+ <h1 >Yikes!</h1 >
17
+
18
+ {#if $page .error ?.message }
19
+ <p class ="error" >{$page .status }: {$page .error .message }</p >
12
20
{/if }
13
- </div >
21
+
22
+ <p >Please try reloading the page.</p >
23
+
24
+ <p >
25
+ If the error persists, please drop by <a href =" https://svelte.dev/chat" >Discord chatroom</a >
26
+ and let us know, or raise an issue on
27
+ <a href =" https://github.com/sveltejs/svelte" >GitHub</a >. Thanks!
28
+ </p >
29
+ {:else }
30
+ <h1 >It looks like you're offline</h1 >
31
+
32
+ <p >Reload the page once you've found the internet.</p >
33
+ {/if }
14
34
</div >
15
35
16
36
<style >
17
- .error {
18
- display : flex ;
19
- width : 100% ;
20
- height : 100% ;
21
- flex-direction : column ;
22
- justify-content : center ;
23
- align-items : center ;
24
- padding : 2rem ;
37
+ .container {
38
+ padding : 4rem ;
39
+ }
40
+ h1 ,
41
+ p {
42
+ margin : 0 auto ;
25
43
}
26
-
27
44
h1 {
28
- font-weight : 400 ;
29
- font-size : 8rem ;
30
- text-align : center ;
45
+ font-size : 2.8em ;
46
+ font-weight : 300 ;
47
+ margin : 0 ;
48
+ margin-bottom : 0.5em ;
31
49
}
32
-
33
- pre {
34
- /* max-width: 40em; */
35
- font-size : 1.4rem ;
50
+ p {
51
+ margin : 1em auto ;
52
+ }
53
+ .error {
54
+ background-color : #da106e ;
55
+ color : white ;
56
+ padding : 12px 16px ;
57
+ font : 600 16px /1.7 var (--sk-font );
58
+ border-radius : 2px ;
36
59
}
37
60
</style >
You can’t perform that action at this time.
0 commit comments