htmgo/sandbox/partials/button.go
2024-09-13 21:52:41 -05:00

26 lines
657 B
Go

package partials
import (
"github.com/maddalax/htmgo/framework-ui/ui"
"github.com/maddalax/htmgo/framework/h"
)
func OpenSheetButton(open bool, children ...h.Renderable) h.Renderable {
if open {
return ui.PrimaryButton(ui.ButtonProps{
Id: "open-sheet",
Text: "Close NewsSheet",
Target: "#sheet-partial",
Get: h.GetPartialPathWithQs(NewsSheet, "open=false"),
Children: children,
})
} else {
return ui.PrimaryButton(ui.ButtonProps{
Id: "open-sheet",
Text: "Open NewsSheet",
Target: "#sheet-partial",
Get: h.GetPartialPathWithQs(NewsSheet, "open=true"),
Children: children,
})
}
}