Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

list: make help message pop #105

Merged
merged 1 commit into from
Jun 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions cmd/component/list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import (

var docStyle = lipgloss.NewStyle().Margin(3, 3)

var helpStyle = lipgloss.NewStyle().Foreground(lipgloss.AdaptiveColor{Light: "#04B575", Dark: "#04B575"})

type Item struct {
Command string
DescriptionText string
Expand Down Expand Up @@ -42,6 +44,11 @@ func NewModelWithDelegate(items []Item, title string, url string, delegate list.
list: list.New(listItems, delegate, 0, 0),
}
m.list.Title = title
m.list.Styles.HelpStyle = helpStyle
m.list.Help.Styles.ShortKey = helpStyle
m.list.Help.Styles.FullKey = helpStyle
m.list.Help.Styles.ShortDesc = helpStyle
m.list.Help.Styles.FullDesc = helpStyle

m.editBinding = key.NewBinding(key.WithKeys("e"), key.WithHelp("e", "edit online"))
m.list.AdditionalFullHelpKeys = func() []key.Binding {
Expand Down