package ui import ( "strings" "charm.land/lipgloss/v2" zone "github.com/lrstanley/bubblezone/v2" "github.com/anotherhadi/ilovetui/style" ) const searchBoxZone = "search-box" func (m Model) renderHeader() string { title := clampToWidth(headerStyle.Render("Default Creds TUI")+subtleStyle.Render(" ยท "+m.sourceLabel()), m.width) return strings.Join([]string{title, "", m.renderSearchBox(), ""}, "\n") } func (m Model) renderSearchBox() string { box := style.S.Panel titleColor := style.S.Subtle if m.searching { box = style.S.PanelFocused titleColor = style.S.Primary } box = box.Padding(0, 1) width := max(m.width, 10) var rendered string if style.S.NerdFonts { rendered = box.Width(width).Render(m.searchInput.View()) } else { title := lipgloss.NewStyle().Foreground(titleColor).Render("Search") rendered = style.RenderWithTitle(box, title, m.searchInput.View(), width, 3) } return zone.Mark(searchBoxZone, rendered) }