From a727687efa00f3489883bb8743a3302b0faeb526 Mon Sep 17 00:00:00 2001 From: kyu08 <49891479+kyu08@users.noreply.github.com> Date: Sun, 26 May 2024 21:30:14 +0900 Subject: [PATCH] centerize loading message --- ui/components/table/table.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ui/components/table/table.go b/ui/components/table/table.go index 8868f2e6..ed941f8a 100644 --- a/ui/components/table/table.go +++ b/ui/components/table/table.go @@ -1,6 +1,7 @@ package table import ( + "fmt" "time" "github.com/charmbracelet/bubbles/spinner" @@ -233,8 +234,13 @@ func (m *Model) renderBody() string { MaxWidth(m.dimensions.Width) if m.isLoading { - // TODO: center - return bodyStyle.Render(m.LoadingSpinner.View(), m.loadingMessage) + return lipgloss.Place( + m.dimensions.Width, + m.dimensions.Height, + lipgloss.Center, + lipgloss.Center, + fmt.Sprintf("%s%s", m.LoadingSpinner.View(), m.loadingMessage), + ) } if len(m.Rows) == 0 && m.EmptyState != nil {