Skip to content

Commit

Permalink
fix examples with latest types
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenlacy committed Apr 13, 2021
1 parent 1dae00c commit eaee308
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions examples/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func rootHandler(w http.ResponseWriter, r *http.Request) {
"rel": "stylesheet",
})

meta := []func() string{
meta := []HTML{
H("meta", Attr{"charset": "UTF-8"}),
H("meta", Attr{
"name": "viewport",
Expand All @@ -49,9 +49,9 @@ func rootHandler(w http.ResponseWriter, r *http.Request) {
w.Write([]byte(html()))
}

func navItems(user User) []func() string {
func navItems(user User) []HTML {
// get itmes from somewhere such as a database
items := []func() string{H("li", "item one"), H("li", "item two")}
items := []HTML{H("li", "item one"), H("li", "item two")}

// example runtime modification
lastElement := H("li", user.Name)
Expand All @@ -60,7 +60,7 @@ func navItems(user User) []func() string {
}

// AppComponent is a daz component. It returns a daz.H func
func AppComponent(user User, description string) func() string {
func AppComponent(user User, description string) HTML {
nav := H("nav", navItems(user))
return H(
"div", Attr{"class": "bg-grey-50"},
Expand Down

0 comments on commit eaee308

Please sign in to comment.