Skip to content

Commit

Permalink
Fix example app to use maragu.dev/gomponents module path (#216)
Browse files Browse the repository at this point in the history
  • Loading branch information
markuswustenberg authored Oct 3, 2024
1 parent fe24f05 commit c094266
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion internal/examples/app/cmd/app/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ import (

func main() {
if err := http.Start(); err != nil {
slog.Info("Error", 1, "error", err)
slog.Info("Error starting", "error", err)
}
}
2 changes: 1 addition & 1 deletion internal/examples/app/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ module app

go 1.23.1

require github.com/maragudk/gomponents v0.20.5
require maragu.dev/gomponents v0.22.1-0.20241003092644-fe24f0575214
4 changes: 2 additions & 2 deletions internal/examples/app/go.sum
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github.com/maragudk/gomponents v0.20.5 h1:Z8phdQIW+NqAGO0clMh/wyv1/M7viUBf7/EL44gvwtI=
github.com/maragudk/gomponents v0.20.5/go.mod h1:nHkNnZL6ODgMBeJhrZjkMHVvNdoYsfmpKB2/hjdQ0Hg=
maragu.dev/gomponents v0.22.1-0.20241003092644-fe24f0575214 h1:bNGcux5RpG5WWQby69VsE0GexUxryln8ltlfdaf06oI=
maragu.dev/gomponents v0.22.1-0.20241003092644-fe24f0575214/go.mod h1:oEDahza2gZoXDoDHhw8jBNgH+3UR5ni7Ur648HORydM=
4 changes: 2 additions & 2 deletions internal/examples/app/html/about.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package html
import (
"time"

. "github.com/maragudk/gomponents"
. "github.com/maragudk/gomponents/html"
. "maragu.dev/gomponents"
. "maragu.dev/gomponents/html"
)

func AboutPage() Node {
Expand Down
6 changes: 3 additions & 3 deletions internal/examples/app/html/components.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package html

import (
. "github.com/maragudk/gomponents"
. "github.com/maragudk/gomponents/components"
. "github.com/maragudk/gomponents/html"
. "maragu.dev/gomponents"
. "maragu.dev/gomponents/components"
. "maragu.dev/gomponents/html"
)

func page(title string, children ...Node) Node {
Expand Down
6 changes: 3 additions & 3 deletions internal/examples/app/html/home.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package html

import (
. "github.com/maragudk/gomponents"
. "github.com/maragudk/gomponents/html"
. "maragu.dev/gomponents"
. "maragu.dev/gomponents/html"
)

func HomePage(items []string) Node {
Expand All @@ -11,7 +11,7 @@ func HomePage(items []string) Node {

P(Text("This is a gomponents example app!")),

P(Raw(`Have a look at the <a href="https://github.com/maragudk/gomponents/tree/main/internal/examples/app">source code</a> to see how it’s structured.`)),
P(Raw(`Have a look at the <a href="https://maragu.dev/gomponents/tree/main/internal/examples/app">source code</a> to see how it’s structured.`)),

Ul(Map(items, func(s string) Node {
return Li(Text(s))
Expand Down
8 changes: 4 additions & 4 deletions internal/examples/app/http/pages.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ package http
import (
"net/http"

g "github.com/maragudk/gomponents"
ghttp "github.com/maragudk/gomponents/http"
. "maragu.dev/gomponents"
ghttp "maragu.dev/gomponents/http"

"app/html"
)

func Home(mux *http.ServeMux) {
mux.Handle("GET /", ghttp.Adapt(func(w http.ResponseWriter, r *http.Request) (g.Node, error) {
mux.Handle("GET /", ghttp.Adapt(func(w http.ResponseWriter, r *http.Request) (Node, error) {
// Let's pretend this comes from a db or something.
items := []string{"Super", "Duper", "Nice"}
return html.HomePage(items), nil
}))
}

func About(mux *http.ServeMux) {
mux.Handle("GET /about", ghttp.Adapt(func(w http.ResponseWriter, r *http.Request) (g.Node, error) {
mux.Handle("GET /about", ghttp.Adapt(func(w http.ResponseWriter, r *http.Request) (Node, error) {
return html.AboutPage(), nil
}))
}

0 comments on commit c094266

Please sign in to comment.