blob: 55da10b2591669b416dd91e9c47e4da9d45c118f (
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
30
31
32
|
package menu
import (
"github.com/charmbracelet/lipgloss"
"github.com/ewy1/pik/menu/style"
)
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)
// do not pad the bottom source, the motd goes there
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))
}
|