unify components and layout

This commit is contained in:
Robin Olsen
2026-02-24 15:13:31 +01:00
parent dd92c5741a
commit 38ae7905c1
24 changed files with 802 additions and 963 deletions

View File

@@ -8,7 +8,13 @@ package components
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
func SearchForm(searchQuery string) templ.Component {
type SearchFormProps struct {
RootURL string
SearchQuery string
Target string
}
func SearchForm(props SearchFormProps) 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 {
@@ -29,20 +35,46 @@ func SearchForm(searchQuery string) templ.Component {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<form class=\"flex gap-2 items-center\" hx-get=\"/\" hx-target=\"main\" hx-swap=\"innerHTML\" hx-push-url=\"true\" hx-trigger=\"submit, input changed delay:400ms from:input[name='q']\"><input type=\"search\" name=\"q\" value=\"")
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<form class=\"flex items-center\" hx-get=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(searchQuery)
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(props.RootURL)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/web/components/search.templ`, Line: 15, Col: 22}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/web/components/search.templ`, Line: 12, Col: 24}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "\" placeholder=\"Search by title, description, or assignee...\" class=\"input input-md input-bordered text-base-content w-48 md:w-64\" aria-label=\"Search issues\"></form>")
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "\" hx-target=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(props.Target)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/web/components/search.templ`, Line: 13, Col: 26}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "\" hx-swap=\"innerHTML\" hx-trigger=\"input changed delay:400ms from:input[name='q']\" hx-vals='{\"partial\": \"true\"}'><input type=\"search\" name=\"q\" value=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(props.SearchQuery)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/web/components/search.templ`, Line: 21, Col: 28}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "\" placeholder=\"Search by id, title or description\" class=\"input input-md text-base-content w-full\" aria-label=\"Search issues\"></form>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}