-
Notifications
You must be signed in to change notification settings - Fork 20
/
main.go
44 lines (32 loc) · 955 Bytes
/
main.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
// Copyright (c) 2016 Paul Jolly <paul@myitcv.org.uk>, all rights reserved.
// Use of this document is governed by a license found in the LICENSE document.
package main
import (
"net/url"
"myitcv.io/react"
"myitcv.io/react/examples/todoapp"
"honnef.co/go/js/dom"
)
var document = dom.GetWindow().Document().(dom.HTMLDocument)
func main() {
domTarget := document.GetElementByID("todoapp")
u, err := url.Parse(document.URL())
if err != nil {
panic(err)
}
var elems []react.Element
if u.Query().Get("hideGithubRibbon") != "true" {
a := react.A(
&react.AProps{
ClassName: "github-fork-ribbon right-top",
Target: "_blank",
Href: "https://github.com/myitcv/x/blob/master/react/examples/sites/todoapp/main.go",
Title: "Source on GitHub",
},
react.S("Source on GitHub"),
)
elems = append(elems, a)
}
elems = append(elems, todoapp.TodoApp())
react.Render(react.Div(nil, elems...), domTarget)
}