github.com/jgarto/itcv@v0.0.0-20180826224514-4eea09c1aa0d/examples/sites/todoapp/main.go (about) 1 // Copyright (c) 2016 Paul Jolly <paul@myitcv.org.uk>, all rights reserved. 2 // Use of this document is governed by a license found in the LICENSE document. 3 4 package main 5 6 import ( 7 "net/url" 8 9 "myitcv.io/react" 10 "myitcv.io/react/examples/todoapp" 11 12 "honnef.co/go/js/dom" 13 ) 14 15 var document = dom.GetWindow().Document().(dom.HTMLDocument) 16 17 func main() { 18 domTarget := document.GetElementByID("todoapp") 19 20 u, err := url.Parse(document.URL()) 21 if err != nil { 22 panic(err) 23 } 24 25 var elems []react.Element 26 27 if u.Query().Get("hideGithubRibbon") != "true" { 28 a := react.A( 29 &react.AProps{ 30 ClassName: "github-fork-ribbon right-top", 31 Target: "_blank", 32 Href: "https://github.com/myitcv/react/blob/master/examples/sites/todoapp/main.go", 33 Title: "Source on GitHub", 34 }, 35 react.S("Source on GitHub"), 36 ) 37 38 elems = append(elems, a) 39 } 40 41 elems = append(elems, todoapp.TodoApp()) 42 43 react.Render(react.Div(nil, elems...), domTarget) 44 }