43 lines
1.0 KiB
Go
43 lines
1.0 KiB
Go
// Code generated by wasmgen. DO NOT EDIT.
|
|
package app
|
|
|
|
import "kjol/vdom"
|
|
|
|
// Routes maps each //gowasm:page path to its instantiated render function.
|
|
func Routes(d Deps) map[string]func() *vdom.VNode {
|
|
return map[string]func() *vdom.VNode{
|
|
"/": HomePage(d),
|
|
"/about": AboutPage(d),
|
|
"/chart": ChartPage(d),
|
|
"/kit": KitPage(d),
|
|
"/server": ServerPage(d),
|
|
}
|
|
}
|
|
|
|
// StaticPaths are the routes the server pre-renders (SSR); others render client-side.
|
|
var StaticPaths = map[string]bool{
|
|
"/": true,
|
|
"/about": true,
|
|
"/chart": true,
|
|
}
|
|
|
|
// RouteLayout maps each route to the name of the layout that wraps it.
|
|
var RouteLayout = map[string]string{
|
|
"/": "public",
|
|
"/about": "public",
|
|
"/chart": "app",
|
|
"/kit": "app",
|
|
"/server": "app",
|
|
}
|
|
|
|
// LayoutFor wraps a page's content in the layout declared for its route.
|
|
func LayoutFor(d Deps, path string, content *vdom.VNode) *vdom.VNode {
|
|
switch RouteLayout[path] {
|
|
case "app":
|
|
return AppLayout(d, content)
|
|
case "public":
|
|
return PublicLayout(d, content)
|
|
}
|
|
return AppLayout(d, content)
|
|
}
|