1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
package main
import (
tui "github.com/grindlemire/go-tui"
)
type helloApp struct{}
func Hello() *helloApp {
return &helloApp{}
}
func (h *helloApp) KeyMap() tui.KeyMap {
return tui.KeyMap{
tui.On(tui.KeyEscape, func(ke tui.KeyEvent) { ke.App().Stop() }),
tui.On(tui.Rune('q'), func(ke tui.KeyEvent) { ke.App().Stop() }),
}
}
func (h *helloApp) Render(app *tui.App) *tui.Element {
__tui_0 := tui.New(
tui.WithDisplay(tui.DisplayFlex), tui.WithDirection(tui.Column),
tui.WithAlign(tui.AlignCenter),
tui.WithJustify(tui.JustifyCenter),
tui.WithHeightPercent(100.00),
)
__tui_1 := tui.New(
tui.WithBorder(tui.BorderRounded),
tui.WithBorderStyle(tui.NewStyle().Foreground(tui.Cyan)),
tui.WithPadding(2),
tui.WithGap(1),
tui.WithDisplay(tui.DisplayFlex), tui.WithDirection(tui.Column),
tui.WithAlign(tui.AlignCenter),
)
__tui_2 := tui.New(
tui.WithText("Hello, Terminal!"),
tui.WithTextStyle(tui.NewStyle().Foreground(tui.Cyan).Bold()),
)
__tui_1.AddChild(__tui_2)
__tui_3 := tui.New(
tui.WithWidth(0),
tui.WithHeight(1),
)
__tui_1.AddChild(__tui_3)
__tui_4 := tui.New(
tui.WithText("Press q to quit"),
tui.WithTextStyle(tui.NewStyle().Dim()),
)
__tui_1.AddChild(__tui_4)
__tui_0.AddChild(__tui_1)
return __tui_0
}
var (
_ tui.KeyListener = (*helloApp)(nil)
)
|