1
0
Fork 0

Added Dialog param

This commit is contained in:
マリウス 2023-01-04 21:41:13 -05:00
parent dbaeadf833
commit 78da08af0b
No known key found for this signature in database
GPG Key ID: 272ED814BF63261F
3 changed files with 21 additions and 10 deletions

View File

@ -6,7 +6,7 @@ import (
"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 style lipgloss.Style
@ -27,16 +27,25 @@ func (tk *ToolKit) Dialog(title string, content string) string {
}
bindings = append(bindings, "esc close")
bottombar := tk.theme.DialogBox.Bottombar.
Width(tk.ViewWidth()).
Render(strings.Join(bindings, " · "))
var ui string
if bbar {
bottombar := tk.theme.DialogBox.Bottombar.
Width(tk.ViewWidth()).
Render(strings.Join(bindings, " · "))
ui := lipgloss.JoinVertical(
lipgloss.Center,
titlebar,
content,
bottombar,
)
ui = lipgloss.JoinVertical(
lipgloss.Center,
titlebar,
content,
bottombar,
)
} else {
ui = lipgloss.JoinVertical(
lipgloss.Center,
titlebar,
content,
)
}
var tmp string
if tk.IsFocused() {

View File

@ -46,6 +46,7 @@ func buildView(mi interface{}, cached bool) string {
return m.tk.Dialog(
title,
m.textarea.View(),
true,
)
}

View File

@ -27,6 +27,7 @@ func buildView(mi interface{}, cached bool) string {
return m.tk.Dialog(
"Post",
viewportStyle.Render(m.viewport.View()),
true,
)
}