Skip to content

Commit

Permalink
centerize loading message
Browse files Browse the repository at this point in the history
  • Loading branch information
kyu08 authored and dlvhdr committed Jun 2, 2024
1 parent 68025d2 commit a727687
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions ui/components/table/table.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package table

import (
"fmt"
"time"

"github.com/charmbracelet/bubbles/spinner"
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit a727687

Please sign in to comment.