diff --git a/internal/server/routes.go b/internal/server/routes.go
index 0d19465..a895b10 100644
--- a/internal/server/routes.go
+++ b/internal/server/routes.go
@@ -7,6 +7,7 @@ import (
"github.com/gofs-cli/template/internal/server/handlers"
activesearch "github.com/gofs-cli/template/internal/ui/pages/active-search"
bulkupdate "github.com/gofs-cli/template/internal/ui/pages/bulk-update"
+ cascadingselect "github.com/gofs-cli/template/internal/ui/pages/cascading-select"
clicktoedit "github.com/gofs-cli/template/internal/ui/pages/click-to-edit"
clicktoload "github.com/gofs-cli/template/internal/ui/pages/click-to-load"
deleterow "github.com/gofs-cli/template/internal/ui/pages/delete-row"
@@ -56,6 +57,10 @@ func (s *Server) Routes() {
routesMux.Handle("GET /active-search", activesearch.Index())
routesMux.Handle("POST /active-search/search", activesearch.Search())
+ // cascading select example
+ routesMux.Handle("GET /cascading-select", cascadingselect.Index())
+ routesMux.Handle("GET /cascading-select/models", cascadingselect.Models())
+
routesMux.Handle("GET /modal", home.Modal())
routesMux.Handle("GET /page1", page1.Index())
diff --git a/internal/ui/pages/cascading-select/handlers.go b/internal/ui/pages/cascading-select/handlers.go
new file mode 100644
index 0000000..8129e55
--- /dev/null
+++ b/internal/ui/pages/cascading-select/handlers.go
@@ -0,0 +1,22 @@
+package cascadingselect
+
+import (
+ "net/http"
+
+ "github.com/a-h/templ"
+ "github.com/gofs-cli/template/internal/ui"
+ "github.com/gofs-cli/template/internal/ui/components/header"
+)
+
+func Index() http.Handler {
+ return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ templ.Handler(ui.IndexPage(layout(header.Header(), body()))).ServeHTTP(w, r)
+ })
+}
+
+func Models() http.Handler {
+ return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ make := r.URL.Query().Get("make")
+ templ.Handler(modelOptions(make)).ServeHTTP(w, r)
+ })
+}
diff --git a/internal/ui/pages/cascading-select/index.templ b/internal/ui/pages/cascading-select/index.templ
new file mode 100644
index 0000000..778e0ad
--- /dev/null
+++ b/internal/ui/pages/cascading-select/index.templ
@@ -0,0 +1,54 @@
+package cascadingselect
+
+css classLayout() {
+ display: grid;
+}
+
+templ layout(header, body templ.Component) {
+
+
+ @header
+
+
+ @body
+
+
+}
+
+templ body() {
+
Cascading Select:
+
+ Make:
+
+ Audi
+ Toyota
+ BMW
+
+
+
+
Model:
+
+ A1
+ A3
+ A6
+
+
+
+}
+
+templ modelOptions(make string) {
+ switch make {
+ case "audi":
+ A1
+ A3
+ A6
+ case "bmw":
+ 325i
+ 325ix
+ X5
+ case "toyota":
+ Landcruiser
+ Tacoma
+ Yaris
+ }
+}
diff --git a/internal/ui/pages/cascading-select/index_templ.go b/internal/ui/pages/cascading-select/index_templ.go
new file mode 100644
index 0000000..a954aac
--- /dev/null
+++ b/internal/ui/pages/cascading-select/index_templ.go
@@ -0,0 +1,155 @@
+// Code generated by templ - DO NOT EDIT.
+
+// templ: version: v0.3.819
+package cascadingselect
+
+//lint:file-ignore SA4006 This context is only used if a nested component is present.
+
+import "github.com/a-h/templ"
+import templruntime "github.com/a-h/templ/runtime"
+
+func classLayout() templ.CSSClass {
+ templ_7745c5c3_CSSBuilder := templruntime.GetBuilder()
+ templ_7745c5c3_CSSBuilder.WriteString(`display:grid;`)
+ templ_7745c5c3_CSSID := templ.CSSID(`classLayout`, templ_7745c5c3_CSSBuilder.String())
+ return templ.ComponentCSSClass{
+ ID: templ_7745c5c3_CSSID,
+ Class: templ.SafeCSS(`.` + templ_7745c5c3_CSSID + `{` + templ_7745c5c3_CSSBuilder.String() + `}`),
+ }
+}
+
+func layout(header, body templ.Component) templ.Component {
+ return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
+ if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
+ return templ_7745c5c3_CtxErr
+ }
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
+ if !templ_7745c5c3_IsBuffer {
+ defer func() {
+ templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err == nil {
+ templ_7745c5c3_Err = templ_7745c5c3_BufErr
+ }
+ }()
+ }
+ ctx = templ.InitializeContext(ctx)
+ templ_7745c5c3_Var1 := templ.GetChildren(ctx)
+ if templ_7745c5c3_Var1 == nil {
+ templ_7745c5c3_Var1 = templ.NopComponent
+ }
+ ctx = templ.ClearChildren(ctx)
+ var templ_7745c5c3_Var2 = []any{classLayout()}
+ templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var2...)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = header.Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = body.Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ return nil
+ })
+}
+
+func body() templ.Component {
+ return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
+ if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
+ return templ_7745c5c3_CtxErr
+ }
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
+ if !templ_7745c5c3_IsBuffer {
+ defer func() {
+ templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err == nil {
+ templ_7745c5c3_Err = templ_7745c5c3_BufErr
+ }
+ }()
+ }
+ ctx = templ.InitializeContext(ctx)
+ templ_7745c5c3_Var4 := templ.GetChildren(ctx)
+ if templ_7745c5c3_Var4 == nil {
+ templ_7745c5c3_Var4 = templ.NopComponent
+ }
+ ctx = templ.ClearChildren(ctx)
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "Cascading Select: Make: Audi Toyota BMW
Model: A1 A3 A6 ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ return nil
+ })
+}
+
+func modelOptions(make string) templ.Component {
+ return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
+ if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
+ return templ_7745c5c3_CtxErr
+ }
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
+ if !templ_7745c5c3_IsBuffer {
+ defer func() {
+ templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err == nil {
+ templ_7745c5c3_Err = templ_7745c5c3_BufErr
+ }
+ }()
+ }
+ ctx = templ.InitializeContext(ctx)
+ templ_7745c5c3_Var5 := templ.GetChildren(ctx)
+ if templ_7745c5c3_Var5 == nil {
+ templ_7745c5c3_Var5 = templ.NopComponent
+ }
+ ctx = templ.ClearChildren(ctx)
+ switch make {
+ case "audi":
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "A1 A3 A6 ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ case "bmw":
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "325i 325ix X5 ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ case "toyota":
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "Landcruiser Tacoma Yaris ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ return nil
+ })
+}
+
+var _ = templruntime.GeneratedTemplate
diff --git a/internal/ui/pages/home/index.templ b/internal/ui/pages/home/index.templ
index 7ede121..0628c21 100644
--- a/internal/ui/pages/home/index.templ
+++ b/internal/ui/pages/home/index.templ
@@ -57,7 +57,7 @@ templ body() {
Progress Bar
- Value Select
+ Value Select
Animations
diff --git a/internal/ui/pages/home/index_templ.go b/internal/ui/pages/home/index_templ.go
index 00a2af3..0b1c66b 100644
--- a/internal/ui/pages/home/index_templ.go
+++ b/internal/ui/pages/home/index_templ.go
@@ -112,7 +112,7 @@ func body() templ.Component {
templ_7745c5c3_Var4 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "Welcome to the sample application! This application demonstrates how to use htmx with Go. The following examples are based on the htmx examples: https://htmx.org/examples/ Home Demo: Modal Open Modal Demo: Toast Success Toast Info Toast Warning Toast Error Toast
")
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "Welcome to the sample application! This application demonstrates how to use htmx with Go. The following examples are based on the htmx examples: https://htmx.org/examples/ Home Demo: Modal Open Modal Demo: Toast Success Toast Info Toast Warning Toast Error Toast
")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}