on main help sign in
small size fix and colors added
796bbf4Kujtim Hoxha
internal/tui/components/logs/table.go+4
@@ -10,6 +10,7 @@ import (
10 "github.com/kujtimiihoxha/termai/internal/logging"
10 "github.com/kujtimiihoxha/termai/internal/logging"
11 "github.com/kujtimiihoxha/termai/internal/pubsub"
11 "github.com/kujtimiihoxha/termai/internal/pubsub"
12 "github.com/kujtimiihoxha/termai/internal/tui/layout"
12 "github.com/kujtimiihoxha/termai/internal/tui/layout"
13+ "github.com/kujtimiihoxha/termai/internal/tui/styles"
13)
14)
14
15
15type TableComponent interface {
16type TableComponent interface {
@@ -122,8 +123,11 @@ func NewLogsTable() TableComponent {
122 {Title: "Message", Width: 10},
123 {Title: "Message", Width: 10},
123 {Title: "Attributes", Width: 10},
124 {Title: "Attributes", Width: 10},
124 }
125 }
126+ defaultStyles := table.DefaultStyles()
127+ defaultStyles.Selected = defaultStyles.Selected.Foreground(styles.Primary)
125 tableModel := table.New(
128 tableModel := table.New(
126 table.WithColumns(columns),
129 table.WithColumns(columns),
130+ table.WithStyles(defaultStyles),
127 )
131 )
128 return &tableCmp{
132 return &tableCmp{
129 table: tableModel,
133 table: tableModel,
internal/tui/layout/single.go+10−9
@@ -93,24 +93,25 @@ func (s *singlePaneLayout) SetSize(width, height int) {
93 s.width -= 2
93 s.width -= 2
94 s.height -= 2
94 s.height -= 2
95 }
95 }
96+ childWidth, childHeight := s.width, s.height
96 if s.padding != nil {
97 if s.padding != nil {
97 if len(s.padding) == 1 {
98 if len(s.padding) == 1 {
98− s.width -= s.padding[0] * 2
99+ childWidth -= s.padding[0] * 2
99− s.height -= s.padding[0] * 2
100+ childHeight -= s.padding[0] * 2
100 } else if len(s.padding) == 2 {
101 } else if len(s.padding) == 2 {
101− s.width -= s.padding[0] * 2
102+ childWidth -= s.padding[0] * 2
102− s.height -= s.padding[1] * 2
103+ childHeight -= s.padding[1] * 2
103 } else if len(s.padding) == 3 {
104 } else if len(s.padding) == 3 {
104− s.width -= s.padding[0] * 2
105+ childWidth -= s.padding[0] * 2
105− s.height -= s.padding[1] + s.padding[2]
106+ childHeight -= s.padding[1] + s.padding[2]
106 } else if len(s.padding) == 4 {
107 } else if len(s.padding) == 4 {
107− s.width -= s.padding[0] + s.padding[2]
108+ childWidth -= s.padding[0] + s.padding[2]
108− s.height -= s.padding[1] + s.padding[3]
109+ childHeight -= s.padding[1] + s.padding[3]
109 }
110 }
110 }
111 }
111 if s.content != nil {
112 if s.content != nil {
112 if c, ok := s.content.(Sizeable); ok {
113 if c, ok := s.content.(Sizeable); ok {
113− c.SetSize(s.width, s.height)
114+ c.SetSize(childWidth, childHeight)
114 }
115 }
115 }
116 }
116}
117}
internal/tui/styles/styles.go+4
@@ -18,6 +18,7 @@ var (
18 Border = Regular.Border(lipgloss.NormalBorder())
18 Border = Regular.Border(lipgloss.NormalBorder())
19 ThickBorder = Regular.Border(lipgloss.ThickBorder())
19 ThickBorder = Regular.Border(lipgloss.ThickBorder())
20 DoubleBorder = Regular.Border(lipgloss.DoubleBorder())
20 DoubleBorder = Regular.Border(lipgloss.DoubleBorder())
21+
21 // Colors
22 // Colors
22
23
23 Surface0 = lipgloss.AdaptiveColor{
24 Surface0 = lipgloss.AdaptiveColor{
@@ -118,4 +119,7 @@ var (
118 Dark: dark.Peach().Hex,
119 Dark: dark.Peach().Hex,
119 Light: light.Peach().Hex,
120 Light: light.Peach().Hex,
120 }
121 }
122+
123+ Primary = Blue
124+ Secondary = Mauve
121)
125)