c7e890cfe7117547d205f4b64105d79480f932a9

Author
Christian Rocha <christian@rocha.is>
Committer
Ayman Bagabas <ayman.bagabas@gmail.com>
Date

Message

chore: adjust top-level tab style

Diff

  1diff --git a/ui/components/tabs/tabs.go b/ui/components/tabs/tabs.go
  2index 4fdb9b1d76207f485120848555311b47692b7675..c893b92624bdf54e25bef38d4d60c1c16b410035 100644
  3--- a/ui/components/tabs/tabs.go
  4+++ b/ui/components/tabs/tabs.go
  5@@ -22,6 +22,8 @@ type Tabs struct {
  6 	TabSeparator lipgloss.Style
  7 	TabInactive  lipgloss.Style
  8 	TabActive    lipgloss.Style
  9+	TabDot       lipgloss.Style
 10+	UseDot       bool
 11 }
 12 
 13 // New creates a new Tabs component.
 14@@ -76,8 +78,13 @@ func (t *Tabs) View() string {
 15 	sep := t.TabSeparator
 16 	for i, tab := range t.tabs {
 17 		style := t.TabInactive.Copy()
 18+		prefix := "  "
 19 		if i == t.activeTab {
 20 			style = t.TabActive.Copy()
 21+			prefix = t.TabDot.Render("• ")
 22+		}
 23+		if t.UseDot {
 24+			s.WriteString(prefix)
 25 		}
 26 		s.WriteString(style.Render(tab))
 27 		if i != len(t.tabs)-1 {
 28diff --git a/ui/pages/selection/selection.go b/ui/pages/selection/selection.go
 29index 47ea1624548983b1c284ecc92436ab7686dc402b..0e965a7f7006f2c51f9a5c08f199e93a61e00aba 100644
 30--- a/ui/pages/selection/selection.go
 31+++ b/ui/pages/selection/selection.go
 32@@ -52,14 +52,10 @@ func New(cfg *config.Config, pk ssh.PublicKey, common common.Common) *Selection
 33 	}
 34 	t := tabs.New(common, ts)
 35 	t.TabSeparator = lipgloss.NewStyle()
 36-	t.TabInactive = lipgloss.NewStyle().
 37-		Bold(true).
 38-		UnsetBackground().
 39-		Foreground(common.Styles.InactiveBorderColor).
 40-		Padding(0, 1)
 41-	t.TabActive = t.TabInactive.Copy().
 42-		Background(lipgloss.Color("62")).
 43-		Foreground(lipgloss.Color("230"))
 44+	t.TabInactive = common.Styles.TopLevelTabNormal.Copy()
 45+	t.TabActive = common.Styles.TopLevelActiveTab.Copy()
 46+	t.TabDot = common.Styles.TopLevelActiveTabDot.Copy()
 47+	t.UseDot = true
 48 	sel := &Selection{
 49 		cfg:        cfg,
 50 		pk:         pk,
 51@@ -86,9 +82,7 @@ func (s *Selection) getMargins() (wm, hm int) {
 52 	hm = s.common.Styles.Tabs.GetVerticalFrameSize() +
 53 		s.common.Styles.Tabs.GetHeight() +
 54 		2 // tabs margin see View()
 55-	switch s.activePane {
 56-	case selectorPane:
 57-	case readmePane:
 58+	if s.activePane == readmePane {
 59 		hm += 1 // readme statusbar
 60 	}
 61 	return
 62@@ -303,15 +297,11 @@ func (s *Selection) View() string {
 63 			Width(s.common.Width - wm).
 64 			Foreground(s.common.Styles.InactiveBorderColor).
 65 			Render(status)
 66-		view = rs.Render(lipgloss.JoinVertical(lipgloss.Top,
 67+		view = rs.Render(lipgloss.JoinVertical(lipgloss.Left,
 68 			s.readme.View(),
 69 			readmeStatus,
 70 		))
 71 	}
 72-	ts := s.common.Styles.Tabs.Copy().
 73-		MarginBottom(1)
 74-	return lipgloss.JoinVertical(lipgloss.Top,
 75-		ts.Render(s.tabs.View()),
 76-		view,
 77-	)
 78+	ts := s.common.Styles.Tabs.Copy()
 79+	return lipgloss.JoinVertical(lipgloss.Left, ts.Render(s.tabs.View()), view)
 80 }
 81diff --git a/ui/styles/styles.go b/ui/styles/styles.go
 82index 9d0883991ae4187564e43b1563a2fe409a66312d..5b079bbfb0c20d7f1a36fef2b3ae16e3567aa220 100644
 83--- a/ui/styles/styles.go
 84+++ b/ui/styles/styles.go
 85@@ -12,8 +12,11 @@ type Styles struct {
 86 	ActiveBorderColor   lipgloss.Color
 87 	InactiveBorderColor lipgloss.Color
 88 
 89-	App        lipgloss.Style
 90-	ServerName lipgloss.Style
 91+	App                  lipgloss.Style
 92+	ServerName           lipgloss.Style
 93+	TopLevelNormalTab    lipgloss.Style
 94+	TopLevelActiveTab    lipgloss.Style
 95+	TopLevelActiveTabDot lipgloss.Style
 96 
 97 	MenuItem       lipgloss.Style
 98 	MenuLastUpdate lipgloss.Style
 99@@ -142,6 +145,15 @@ func DefaultStyles() *Styles {
100 		Foreground(lipgloss.Color("229")).
101 		Bold(true)
102 
103+	s.TopLevelNormalTab = lipgloss.NewStyle().
104+		MarginRight(2)
105+
106+	s.TopLevelActiveTab = s.TopLevelNormalTab.Copy().
107+		Foreground(lipgloss.Color("42"))
108+
109+	s.TopLevelActiveTabDot = lipgloss.NewStyle().
110+		Foreground(lipgloss.Color("29"))
111+
112 	s.MenuItem = lipgloss.NewStyle().
113 		PaddingLeft(1).
114 		Border(lipgloss.Border{