feat: Update table border rendering to use different characters based on position

- Add borderChar variable to determine border style based on position parameter
- Use "=" for top and bottom borders, "-" for middle borders
- Replace hardcoded "=" with dynamic borderChar in sections rendering
- Remove redundant comment about convenience methods
This commit is contained in:
nutcas3
2026-04-17 16:13:35 +03:00
parent 873e4854a5
commit d670c62562
+12 -3
View File
@@ -225,13 +225,24 @@ func (t *Table) renderBorderLine(position string) string {
}
var sections []string
var borderChar string
// Use position parameter to determine border style
switch position {
case "top", "bottom":
borderChar = "="
case "middle":
borderChar = "-"
default:
borderChar = "="
}
for _, col := range t.Columns {
width := col.Width + 2 // Account for padding
if t.Style.Padding > 0 {
width += t.Style.Padding * 2
}
sections = append(sections, strings.Repeat("=", width))
sections = append(sections, strings.Repeat(borderChar, width))
}
border := t.Style.BorderColor.Render("+")
@@ -260,8 +271,6 @@ func (t *Table) padText(text string, width int, alignment string) string {
}
}
// Convenience methods for creating common table types
// NewServicesTable creates a table optimized for service listings with lipgloss styling
func NewServicesTable(colorizer *Colorizer, iconRenderer *IconRenderer) *Table {
table := NewTable(colorizer, iconRenderer)