mirror of
https://github.com/eduardolat/pgbackweb.git
synced 2026-01-24 05:28:36 -06:00
Refactor help button implementation in InputControl and SelectControl components
This commit is contained in:
@@ -3,14 +3,12 @@ package component
|
||||
import (
|
||||
lucide "github.com/eduardolat/gomponents-lucide"
|
||||
"github.com/maragudk/gomponents"
|
||||
"github.com/maragudk/gomponents/components"
|
||||
"github.com/maragudk/gomponents/html"
|
||||
)
|
||||
|
||||
type HelpButtonModalParams struct {
|
||||
ModalTitle string
|
||||
ModalSize size
|
||||
ButtonSize size
|
||||
Children []gomponents.Node
|
||||
}
|
||||
|
||||
@@ -23,19 +21,9 @@ func HelpButtonModal(params HelpButtonModalParams) gomponents.Node {
|
||||
|
||||
button := html.Button(
|
||||
mo.OpenerAttr,
|
||||
components.Classes{
|
||||
"btn btn-neutral btn-ghost btn-circle": true,
|
||||
"btn-sm": params.ButtonSize == SizeSm,
|
||||
"btn-lg": params.ButtonSize == SizeLg,
|
||||
},
|
||||
html.Class("btn btn-neutral btn-ghost btn-circle btn-sm"),
|
||||
html.Type("button"),
|
||||
lucide.CircleHelp(
|
||||
components.Classes{
|
||||
"size-4": params.ButtonSize == SizeSm,
|
||||
"size-6": params.ButtonSize == SizeMd,
|
||||
"size-8": params.ButtonSize == SizeLg,
|
||||
},
|
||||
),
|
||||
lucide.CircleHelp(),
|
||||
)
|
||||
|
||||
return html.Div(
|
||||
|
||||
@@ -52,7 +52,6 @@ func InputControl(params InputControlParams) gomponents.Node {
|
||||
len(params.HelpButtonChildren) > 0,
|
||||
HelpButtonModal(HelpButtonModalParams{
|
||||
ModalTitle: params.Label,
|
||||
ButtonSize: SizeSm,
|
||||
Children: params.HelpButtonChildren,
|
||||
}),
|
||||
),
|
||||
|
||||
@@ -47,7 +47,6 @@ func SelectControl(params SelectControlParams) gomponents.Node {
|
||||
len(params.HelpButtonChildren) > 0,
|
||||
HelpButtonModal(HelpButtonModalParams{
|
||||
ModalTitle: params.Label,
|
||||
ButtonSize: SizeSm,
|
||||
Children: params.HelpButtonChildren,
|
||||
}),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user