-
-
Notifications
You must be signed in to change notification settings - Fork 356
/
notfound.go
48 lines (42 loc) · 851 Bytes
/
notfound.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package app
var (
// NotFound is the ui element that is displayed when a request is not
// routed.
NotFound UI = ¬Found{}
)
type notFound struct {
Compo
Icon string
}
func (n *notFound) OnMount(Context) {
links := Window().Get("document").Call("getElementsByTagName", "link")
for i := 0; i < links.Length(); i++ {
link := links.Index(i)
rel := link.Call("getAttribute", "rel")
if rel.String() == "icon" {
favicon := link.Call("getAttribute", "href")
n.Icon = favicon.String()
n.Update()
return
}
}
}
func (n *notFound) Render() UI {
return Div().
Class("goapp-app-info").
Body(
Div().
Class("goapp-notfound-title").
Body(
Text("4"),
Img().
Class("goapp-logo").
Alt("0").
Src(n.Icon),
Text("4"),
),
P().
Class("goapp-label").
Text("Not Found"),
)
}