Skip to content

Commit

Permalink
Center content so things look more responsive
Browse files Browse the repository at this point in the history
  • Loading branch information
braheezy committed Feb 17, 2024
1 parent a0b56a3 commit 97fde2e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
3 changes: 1 addition & 2 deletions internal/app/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (

"github.com/charmbracelet/bubbles/key"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
zone "github.com/lrstanley/bubblezone"
)

Expand Down Expand Up @@ -98,7 +97,7 @@ func (v Violet) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
// cases. Hopefully this check is good enough to not spam ClearScreen commands.
needsRepaint := false

if msg.Width < lipgloss.Width(v.ecosystem.View()) {
if msg.Width < v.terminalWidth {
needsRepaint = true
}

Expand Down
10 changes: 6 additions & 4 deletions internal/app/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,19 @@ func (v Violet) View() (view string) {
// Title view area
title := titleStyle.Render("Violet:")
greeter := greeterStyle.Render("Pretty manager for Vagrant")
titleGreeter := title + greeter
view += lipgloss.NewStyle().Margin(marginVertical, marginHorizontal).Render(titleGreeter)
titleGreeter := lipgloss.NewStyle().Margin(marginVertical, marginHorizontal).Render(title + greeter)
view += lipgloss.PlaceHorizontal(v.terminalWidth, lipgloss.Center, titleGreeter)

help := v.help.View(v.keys)
view += lipgloss.NewStyle().
helpText := lipgloss.NewStyle().
Margin(marginVertical, marginHorizontal).
Render(help)
view += lipgloss.PlaceHorizontal(v.terminalWidth, lipgloss.Center, helpText)
view += "\n"

// Show the current environments
view += v.ecosystem.View()
ecosystemView := v.ecosystem.View()
view += lipgloss.PlaceHorizontal(v.terminalWidth, lipgloss.Center, ecosystemView)
view += "\n\n"

if len(v.errorMessage) > 0 {
Expand Down

0 comments on commit 97fde2e

Please sign in to comment.