1
0
mirror of https://github.com/mrusme/neonmodem.git synced 2024-07-21 03:14:14 -04:00
neonmodem/ui/windows/popuplist/view.go
2023-01-04 21:40:54 -05:00

33 lines
654 B
Go

package popuplist
import "github.com/charmbracelet/lipgloss"
func (m Model) View() string {
return m.tk.View(&m, true)
}
func buildView(mi interface{}, cached bool) string {
var m *Model = mi.(*Model)
if vcache := m.tk.DefaultCaching(cached); vcache != "" {
m.ctx.Logger.Debugln("Cached View()")
return vcache
}
m.ctx.Logger.Debugln("View()")
m.ctx.Logger.Debugf("IsFocused: %v\n", m.tk.IsFocused())
var style lipgloss.Style
if m.tk.IsFocused() {
style = m.ctx.Theme.PopupList.List.Focused
} else {
style = m.ctx.Theme.PopupList.List.Blurred
}
l := style.Render(m.list.View())
return m.tk.Dialog(
"Select",
l,
false,
)
}