-
Notifications
You must be signed in to change notification settings - Fork 3
/
body.go
40 lines (35 loc) · 1003 Bytes
/
body.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
package components
import (
"github.com/gopherjs/vecty"
"github.com/gopherjs/vecty/elem"
"github.com/gopherjs/vecty/prop"
router "marwan.io/vecty-router"
)
// Body renders the <body> tag
type Body struct {
vecty.Core
}
// Render renders the <body> tag with the App as its children
func (b *Body) Render() vecty.ComponentOrHTML {
return elem.Body(
router.NewRoute("/", &MainView{}, router.NewRouteOpts{ExactMatch: true}),
router.NewRoute("/blog", &BlogView{}, router.NewRouteOpts{ExactMatch: true}),
router.NewRoute("/blog/{id}", &PostView{}, router.NewRouteOpts{ExactMatch: true}),
router.NewRoute("/talks", &Talks{}, router.NewRouteOpts{ExactMatch: true}),
router.NotFoundHandler(¬Found{}),
)
}
type notFound struct {
vecty.Core
}
func (nf *notFound) Render() vecty.ComponentOrHTML {
return elem.Div(
vecty.Markup(prop.ID("home-view")),
elem.Div(
vecty.Markup(prop.ID("home-top")),
elem.Heading1(
vecty.Text("page not found 🤦🏻♂️"),
),
),
)
}