From bac17e8a69b3fb46185bb26b5572c128b61583bb Mon Sep 17 00:00:00 2001 From: sindhu Date: Fri, 3 May 2024 13:49:25 +0700 Subject: [PATCH] step 2 : custom text field search --- .../customtextfieldsearch.templ | 22 +++ .../customtextfieldsearch_templ.go | 146 ++++++++++++++++++ .../mastermenuusergroup.templ | 5 + 3 files changed, 173 insertions(+) create mode 100644 views/component/customtextfieldsearch/customtextfieldsearch.templ create mode 100644 views/component/customtextfieldsearch/customtextfieldsearch_templ.go diff --git a/views/component/customtextfieldsearch/customtextfieldsearch.templ b/views/component/customtextfieldsearch/customtextfieldsearch.templ new file mode 100644 index 0000000..a7c860f --- /dev/null +++ b/views/component/customtextfieldsearch/customtextfieldsearch.templ @@ -0,0 +1,22 @@ +package customtextfieldsearch + +templ MainCustomTextFieldSearch( + inpName, + inpPlaceHolder, + inpType, + hxPost, + hxTrigger, + hxTarget, + hxIndicator string) { + +} \ No newline at end of file diff --git a/views/component/customtextfieldsearch/customtextfieldsearch_templ.go b/views/component/customtextfieldsearch/customtextfieldsearch_templ.go new file mode 100644 index 0000000..cd7cf7c --- /dev/null +++ b/views/component/customtextfieldsearch/customtextfieldsearch_templ.go @@ -0,0 +1,146 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.663 +package customtextfieldsearch + +//lint:file-ignore SA4006 This context is only used if a nested component is present. + +import "github.com/a-h/templ" +import "context" +import "io" +import "bytes" + +func MainCustomTextFieldSearch( + inpName, + inpPlaceHolder, + inpType, + hxPost, + hxTrigger, + hxTarget, + hxIndicator string) templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var1 := templ.GetChildren(ctx) + if templ_7745c5c3_Var1 == nil { + templ_7745c5c3_Var1 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} diff --git a/views/mastermenuusergroup/mastermenuusergroup.templ b/views/mastermenuusergroup/mastermenuusergroup.templ index 6f174e9..5e77b5e 100644 --- a/views/mastermenuusergroup/mastermenuusergroup.templ +++ b/views/mastermenuusergroup/mastermenuusergroup.templ @@ -6,6 +6,7 @@ import ( "github.com/emarifer/go-templ-project-structure/views/component/sidebarmaster" "github.com/emarifer/go-templ-project-structure/views/component/breadcrumbadmin" "github.com/emarifer/go-templ-project-structure/views/component/customtextfield" + "github.com/emarifer/go-templ-project-structure/views/component/customtextfieldsearch" ) @@ -194,7 +195,11 @@ templ MainMasterMenuUserGroup(datamenu []services.MasterMenu) { // EXAMPLE INPUTAN START + // inputan biasa @customtextfield.MainCustomTextField("Kode", "Kode", "kode", "text") + + // inputan dengan search + @customtextfieldsearch.MainCustomTextFieldSearch("cariNama", "Cari PID / Nama", "search", "/search", "input changed delay:500ms, search", "#search-results", ".htmx-indicator") // EXAMPLE INPUTAN END