Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix example app to use maragu.dev/gomponents module path #216

Merged
merged 1 commit into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}))
}
Loading