mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-10-27 23:22:15 +00:00
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:
@@ -225,13 +225,24 @@ func (t *Table) renderBorderLine(position string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var sections []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 {
|
for _, col := range t.Columns {
|
||||||
width := col.Width + 2 // Account for padding
|
width := col.Width + 2 // Account for padding
|
||||||
if t.Style.Padding > 0 {
|
if t.Style.Padding > 0 {
|
||||||
width += t.Style.Padding * 2
|
width += t.Style.Padding * 2
|
||||||
}
|
}
|
||||||
sections = append(sections, strings.Repeat("=", width))
|
sections = append(sections, strings.Repeat(borderChar, width))
|
||||||
}
|
}
|
||||||
|
|
||||||
border := t.Style.BorderColor.Render("+")
|
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
|
// NewServicesTable creates a table optimized for service listings with lipgloss styling
|
||||||
func NewServicesTable(colorizer *Colorizer, iconRenderer *IconRenderer) *Table {
|
func NewServicesTable(colorizer *Colorizer, iconRenderer *IconRenderer) *Table {
|
||||||
table := NewTable(colorizer, iconRenderer)
|
table := NewTable(colorizer, iconRenderer)
|
||||||
|
|||||||
Reference in New Issue
Block a user