From 60e1a161ca078527c589e6a24200c43887cc2e52 Mon Sep 17 00:00:00 2001 From: maddalax Date: Mon, 28 Oct 2024 18:55:42 -0500 Subject: [PATCH] simplify since we arent allowing editing on load --- htmgo-site/partials/snippets/click-to-edit.go | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/htmgo-site/partials/snippets/click-to-edit.go b/htmgo-site/partials/snippets/click-to-edit.go index cad0135..eb9ae44 100644 --- a/htmgo-site/partials/snippets/click-to-edit.go +++ b/htmgo-site/partials/snippets/click-to-edit.go @@ -18,10 +18,6 @@ type Record struct { Salary string } -type TableProps struct { - EditingId string -} - var records = []Record{ { Id: "1", @@ -43,10 +39,7 @@ func ClickToEdit(ctx *h.RequestContext) *h.Partial { return h.NewPartial( h.Div( h.Class("flex gap-2 items-center w-full"), - Table(TableProps{ - // no record is being edited initially - EditingId: "", - }), + Table(), ), ) } @@ -89,7 +82,7 @@ func SaveEditing(ctx *h.RequestContext) *h.Partial { return h.SwapPartial(ctx, TableRow(&record, false)) } -func Table(props TableProps) *h.Element { +func Table() *h.Element { return h.Div( h.Class("overflow-x-auto w-full"), h.Table( @@ -120,8 +113,7 @@ func Table(props TableProps) *h.Element { h.TBody( h.Class("divide-y divide-gray-200"), h.List(records, func(record Record, index int) *h.Element { - editing := props.EditingId == record.Id - return TableRow(&record, editing) + return TableRow(&record, false) }), ), ),