From b05e4fcbcb59bdf20ca7b3e27f8ed15fea594cad Mon Sep 17 00:00:00 2001 From: Kyren223 Date: Mon, 25 Nov 2024 23:49:40 +0200 Subject: Added typing and input validation to network creation popup --- internal/client/ui/layouts/flex/flex.go | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'internal/client/ui/layouts/flex') diff --git a/internal/client/ui/layouts/flex/flex.go b/internal/client/ui/layouts/flex/flex.go index 6f39ec1..def7a18 100644 --- a/internal/client/ui/layouts/flex/flex.go +++ b/internal/client/ui/layouts/flex/flex.go @@ -16,8 +16,18 @@ type Model struct { Vertical bool } -func New() Model { - return Model{} +func NewHorizontal(contents ...string) Model { + return Model{ + contents: contents, + Vertical: false, + } +} + +func NewVertical(contents ...string) Model { + return Model{ + contents: contents, + Vertical: true, + } } func (m Model) Init() tea.Cmd { @@ -54,3 +64,8 @@ func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) { func (m *Model) SetContents(contents ...string) { m.contents = contents } + +func (m Model) WithGap(gap int) Model { + m.Gap = gap + return m +} -- cgit v1.3.1