-
-
Notifications
You must be signed in to change notification settings - Fork 356
/
js-page.go
48 lines (40 loc) · 1.17 KB
/
js-page.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 main
import (
"github.com/maxence-charriere/go-app/v10/pkg/analytics"
"github.com/maxence-charriere/go-app/v10/pkg/app"
)
type jsPage struct {
app.Compo
}
func newJSPage() *jsPage {
return &jsPage{}
}
func (p *jsPage) OnNav(ctx app.Context) {
p.initPage(ctx)
}
func (p *jsPage) initPage(ctx app.Context) {
ctx.Page().SetTitle("JavaScript Interoperability")
ctx.Page().SetDescription("Documentation about how to call JavaScript from Go or Go from JavaScript.")
analytics.Page("js", nil)
}
func (p *jsPage) Render() app.UI {
return newPage().
Title("JavaScript Interoperability").
Icon(jsSVG).
Index(
newIndexLink().Title("Intro"),
newIndexLink().Title("Include JS files"),
newIndexLink().Title(" Page's scope"),
newIndexLink().Title(" Inlined in Components"),
newIndexLink().Title("Using window global object"),
newIndexLink().Title(" Get element by ID"),
newIndexLink().Title(" Create JS object"),
newIndexLink().Title("Cancel an event"),
newIndexLink().Title("Get input value"),
app.Div().Class("separator"),
newIndexLink().Title("Next"),
).
Content(
newRemoteMarkdownDoc().Src("/web/documents/js.md"),
)
}