gitstack

grindlemire/go-tui code browser

1.1 KB Go 49 lines 2026-07-10 · 0592ab2 raw
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
// Code generated by tui generate. DO NOT EDIT.
// Source: markdown.gsx

package testdata

import (
	tui "github.com/grindlemire/go-tui"
)

type docView struct {
	readme string
}

func DocView(readme string) *docView {
	return &docView{readme: readme}
}

func (c *docView) Render(app *tui.App) *tui.Element {
	__tui_0 := tui.New(
		tui.WithDisplay(tui.DisplayFlex), tui.WithDirection(tui.Column),
		tui.WithScrollable(tui.ScrollVertical),
	)
	__tui_1 := app.MountPersistent(c, 0, func() tui.Component {
		return tui.NewMarkdown(
			tui.WithMarkdownSource(c.readme),
			tui.WithMarkdownWidth(80),
		)
	})
	__tui_0.AddChild(__tui_1)

	return __tui_0
}

// updatePropsFields is generated. It copies prop fields from fresh onto
// the receiver. When you override UpdateProps, call this helper instead
// of hand-maintaining the copy list.
func (c *docView) updatePropsFields(fresh tui.Component) {
	f, ok := fresh.(*docView)
	if !ok {
		return
	}
	c.readme = f.readme
}

func (c *docView) UpdateProps(fresh tui.Component) {
	c.updatePropsFields(fresh)
}

var _ tui.PropsUpdater = (*docView)(nil)