blob: fa73ed1c0c645b355b61c91ba155fb371af88e0a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
package menu
import (
"git.ewy.one/pik.git/menu/style"
"github.com/charmbracelet/lipgloss"
)
var (
StateStyle = style.New(func() lipgloss.Style {
return lipgloss.NewStyle().MarginBottom(1)
})
MotdStyle = style.New(func() lipgloss.Style {
return lipgloss.NewStyle().Faint(true).PaddingLeft(1)
})
)
func (m *Model) State() string {
st := m.HydratedState
sources := make([]string, 0, len(st.Sources))
for i, hs := range st.HydratedSources {
src := m.Source(hs)
if i != len(st.HydratedSources)-1 {
src += "\n"
}
sources = append(sources, src)
}
return StateStyle.Render(lipgloss.JoinVertical(lipgloss.Top, sources...), MotdStyle.Render("\n \U000F08B7 "+m.Motd))
}
|