summaryrefslogtreecommitdiff
path: root/menu/state.go
diff options
context:
space:
mode:
Diffstat (limited to 'menu/state.go')
-rw-r--r--menu/state.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/menu/state.go b/menu/state.go
new file mode 100644
index 0000000..16702a2
--- /dev/null
+++ b/menu/state.go
@@ -0,0 +1,29 @@
+package menu
+
+import (
+ "github.com/charmbracelet/lipgloss"
+ "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)
+ 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))
+}