32 lines
578 B
Go
32 lines
578 B
Go
package modals
|
|
|
|
import (
|
|
"git.tordarus.net/Tordarus/tui"
|
|
"git.tordarus.net/Tordarus/tui/views"
|
|
"github.com/gdamore/tcell"
|
|
)
|
|
|
|
type InfoModal struct {
|
|
*views.FrameView
|
|
}
|
|
|
|
func NewInfoModal(message string) *InfoModal {
|
|
tv := views.NewTextView(message)
|
|
bv := views.NewBorderView(views.NewMarginView(tv, 0, 1, 0, 1))
|
|
fv := views.NewFrameView(bv)
|
|
fv.DontClearBuffer = true
|
|
|
|
m := &InfoModal{
|
|
FrameView: fv,
|
|
}
|
|
|
|
m.KeyPressed = func(event *tui.KeyEvent) (consumed bool) {
|
|
if event.Key() == tcell.KeyEnter || event.Key() == tcell.KeyESC {
|
|
|
|
}
|
|
return true
|
|
}
|
|
|
|
return m
|
|
}
|