File tree 3 files changed +44
-0
lines changed
3 files changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,12 @@ function removeLoader() {
10
10
export default Route (
11
11
<template >
12
12
<Page >
13
+ <: pending >
14
+ <div class =" loading-page" >
15
+ Loading, compiling, etc
16
+ </div >
17
+ </: pending >
18
+
13
19
<: error as | error | >
14
20
<div style =" border: 1px solid red; padding: 1rem;" data-page-error >
15
21
{{error }}
@@ -23,5 +29,14 @@ export default Route(
23
29
</: success >
24
30
25
31
</Page >
32
+ <style >
33
+ .loading-page {
34
+ position : fixed ;
35
+ top : 3rem ;
36
+ padding : 1rem ;
37
+ background : rgba (255 , 255 , 255 , 0.8 );
38
+ color : black ;
39
+ }
40
+ < /style >
26
41
</template >
27
42
);
Original file line number Diff line number Diff line change @@ -28,6 +28,27 @@ export class Page extends Component<{
28
28
* ```
29
29
*/
30
30
error: [error : string ];
31
+
32
+ /**
33
+ * Before the document is compiled (or errored), this block will be active.
34
+ *
35
+ * Example:
36
+ *
37
+ * ```gjs
38
+ * import { Page } from 'kolay/components';
39
+ *
40
+ * <template >
41
+ * <Page >
42
+ * <: pending >
43
+ * Loading State
44
+ * </: pending >
45
+ * <: success ></: success >
46
+ * </Page >
47
+ * </template >
48
+ * ```
49
+ */
50
+ pending: [];
51
+
31
52
/**
32
53
* If compilation of the active page was successful, the `<:success>` black
33
54
* will be active, and will pass the component reference to the caller.
@@ -56,6 +77,10 @@ export class Page extends Component<{
56
77
{{yield this . selected.error to =' error' }}
57
78
{{/if }}
58
79
80
+ {{#if this . selected.isPending }}
81
+ {{yield to =' pending' }}
82
+ {{/if }}
83
+
59
84
{{#if this . selected.prose }}
60
85
{{yield this . selected.prose to =' success' }}
61
86
{{/if }}
Original file line number Diff line number Diff line change @@ -78,6 +78,10 @@ export default class Selected extends Service {
78
78
return this . proseCompiled . isReady ;
79
79
}
80
80
81
+ get isPending ( ) {
82
+ return ! this . isReady ;
83
+ }
84
+
81
85
get hasError ( ) {
82
86
return Boolean ( this . proseCompiled . error ) || this . request . hasError ;
83
87
}
You can’t perform that action at this time.
0 commit comments