mirror of
https://github.com/mrusme/neonmodem.git
synced 2024-12-04 14:46:37 -05:00
Added Dialog param
This commit is contained in:
parent
dbaeadf833
commit
78da08af0b
@ -6,7 +6,7 @@ import (
|
|||||||
"github.com/charmbracelet/lipgloss"
|
"github.com/charmbracelet/lipgloss"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (tk *ToolKit) Dialog(title string, content string) string {
|
func (tk *ToolKit) Dialog(title string, content string, bbar bool) string {
|
||||||
var view strings.Builder = strings.Builder{}
|
var view strings.Builder = strings.Builder{}
|
||||||
|
|
||||||
var style lipgloss.Style
|
var style lipgloss.Style
|
||||||
@ -27,16 +27,25 @@ func (tk *ToolKit) Dialog(title string, content string) string {
|
|||||||
}
|
}
|
||||||
bindings = append(bindings, "esc close")
|
bindings = append(bindings, "esc close")
|
||||||
|
|
||||||
|
var ui string
|
||||||
|
if bbar {
|
||||||
bottombar := tk.theme.DialogBox.Bottombar.
|
bottombar := tk.theme.DialogBox.Bottombar.
|
||||||
Width(tk.ViewWidth()).
|
Width(tk.ViewWidth()).
|
||||||
Render(strings.Join(bindings, " · "))
|
Render(strings.Join(bindings, " · "))
|
||||||
|
|
||||||
ui := lipgloss.JoinVertical(
|
ui = lipgloss.JoinVertical(
|
||||||
lipgloss.Center,
|
lipgloss.Center,
|
||||||
titlebar,
|
titlebar,
|
||||||
content,
|
content,
|
||||||
bottombar,
|
bottombar,
|
||||||
)
|
)
|
||||||
|
} else {
|
||||||
|
ui = lipgloss.JoinVertical(
|
||||||
|
lipgloss.Center,
|
||||||
|
titlebar,
|
||||||
|
content,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
var tmp string
|
var tmp string
|
||||||
if tk.IsFocused() {
|
if tk.IsFocused() {
|
||||||
|
@ -46,6 +46,7 @@ func buildView(mi interface{}, cached bool) string {
|
|||||||
return m.tk.Dialog(
|
return m.tk.Dialog(
|
||||||
title,
|
title,
|
||||||
m.textarea.View(),
|
m.textarea.View(),
|
||||||
|
true,
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ func buildView(mi interface{}, cached bool) string {
|
|||||||
return m.tk.Dialog(
|
return m.tk.Dialog(
|
||||||
"Post",
|
"Post",
|
||||||
viewportStyle.Render(m.viewport.View()),
|
viewportStyle.Render(m.viewport.View()),
|
||||||
|
true,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user