diff options
| author | Kyren223 <Kyren223@proton.me> | 2024-11-25 22:00:12 +0200 |
|---|---|---|
| committer | Kyren223 <Kyren223@proton.me> | 2024-11-25 22:00:12 +0200 |
| commit | d12ebef2c5b1fdc17d4151f752d4e4d95f6e56b3 (patch) | |
| tree | 2752d5f1517c8f78cc097ce00d91efdef4615529 /internal | |
| parent | 4220143b0412974a3668836fedf8af09d58caa99 (diff) | |
Fixed flex
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/client/ui/layouts/flex/flex.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/internal/client/ui/layouts/flex/flex.go b/internal/client/ui/layouts/flex/flex.go index 48a3090..6f39ec1 100644 --- a/internal/client/ui/layouts/flex/flex.go +++ b/internal/client/ui/layouts/flex/flex.go @@ -9,11 +9,11 @@ type Model struct { Style lipgloss.Style ItemStyle lipgloss.Style - contents []string + contents []string - Position lipgloss.Position - Gap int - Vertical bool + Position lipgloss.Position + Gap int + Vertical bool } func New() Model { @@ -26,13 +26,13 @@ func (m Model) Init() tea.Cmd { func (m Model) View() string { contents := make([]string, len(m.contents)) - for i, content := range contents { - content = m.ItemStyle.Render(content) + for i, content := range m.contents { + contents[i] = m.ItemStyle.Render(content) if i != 0 { if m.Vertical { - contents[i] = lipgloss.NewStyle().PaddingTop(m.Gap).Render(content) + contents[i] = lipgloss.NewStyle().PaddingTop(m.Gap).Render(contents[i]) } else { - contents[i] = lipgloss.NewStyle().PaddingLeft(m.Gap).Render(content) + contents[i] = lipgloss.NewStyle().PaddingLeft(m.Gap).Render(contents[i]) } } } @@ -51,6 +51,6 @@ func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) { return m, nil } -func (m *Model) SetContents(contents []string) { +func (m *Model) SetContents(contents ...string) { m.contents = contents } |
