@@ -33,11 +33,11 @@ type ModulesPanel struct {
3333}
3434
3535func NewModulesPanel (width , height int ) ModulesPanel {
36- delegate := list . NewDefaultDelegate ( )
36+ delegate := newCustomDelegate ( false )
3737 delegate .ShowDescription = false
3838 l := list .New (nil , delegate , width , height )
3939 l .SetShowTitle (true )
40- l .Title = "Modules "
40+ l .Title = "Project "
4141 l .SetShowStatusBar (false )
4242 l .SetFilteringEnabled (true )
4343 return ModulesPanel {list : l , width : width , height : height }
@@ -82,7 +82,10 @@ func (p *ModulesPanel) SetSize(w, h int) {
8282 p .list .SetHeight (h )
8383}
8484
85- func (p * ModulesPanel ) SetFocused (f bool ) { p .focused = f }
85+ func (p * ModulesPanel ) SetFocused (f bool ) {
86+ p .focused = f
87+ p .list .SetDelegate (newCustomDelegate (f ))
88+ }
8689
8790func (p ModulesPanel ) Update (msg tea.Msg ) (ModulesPanel , tea.Cmd ) {
8891 var cmd tea.Cmd
@@ -97,6 +100,29 @@ func (p ModulesPanel) View() string {
97100 return border .Render (p .list .View ())
98101}
99102
103+ func newCustomDelegate (focused bool ) list.DefaultDelegate {
104+ d := list .NewDefaultDelegate ()
105+ if focused {
106+ d .Styles .SelectedTitle = lipgloss .NewStyle ().
107+ Border (lipgloss .NormalBorder (), false , false , false , true ).
108+ BorderForeground (lipgloss .Color ("63" )).
109+ Foreground (lipgloss .Color ("255" )).
110+ Bold (true ).
111+ Padding (0 , 0 , 0 , 1 )
112+ d .Styles .SelectedDesc = d .Styles .SelectedTitle .
113+ Foreground (lipgloss .Color ("63" ))
114+ } else {
115+ d .Styles .SelectedTitle = lipgloss .NewStyle ().
116+ Border (lipgloss .NormalBorder (), false , false , false , true ).
117+ BorderForeground (lipgloss .Color ("240" )).
118+ Foreground (lipgloss .Color ("245" )).
119+ Padding (0 , 0 , 0 , 1 )
120+ d .Styles .SelectedDesc = d .Styles .SelectedTitle .
121+ Foreground (lipgloss .Color ("240" ))
122+ }
123+ return d
124+ }
125+
100126func borderColor (focused bool ) lipgloss.Color {
101127 if focused {
102128 return lipgloss .Color ("63" )
0 commit comments