コード例 #1
7
ファイル: counterpair.go プロジェクト: gmlewis/go-frp
func (m Model) View(rootUpdateFunc, wrapFunc interface{}) h.HTML {
	return h.Div(
		m.top.View(rootUpdateFunc, top(m)),
		m.bottom.View(rootUpdateFunc, bottom(m)),
		h.Button(h.Text("Reset")).OnClick(rootUpdateFunc, rootUpdateFunc, Reset),
	)
}
コード例 #2
5
ファイル: counterlist.go プロジェクト: gmlewis/go-frp
func (m Model) View(rootUpdateFunc, wrapFunc interface{}) h.HTML {
	remove := h.Button(h.Text("Remove")).OnClick(rootUpdateFunc, wrapper(m), Remove)
	insert := h.Button(h.Text("Add")).OnClick(rootUpdateFunc, wrapper(m), Insert)
	p := []h.HTML{remove, insert}
	for id, counter := range m.counters {
		p = append(p, counter.counter.View(rootUpdateFunc, cWrapper(m, id)))
	}
	return h.Div(p...)
}
コード例 #3
3
ファイル: counterpairpair.go プロジェクト: gmlewis/go-frp
func (m Model) View(rootUpdateFunc, wrapFunc interface{}) h.HTML {
	var wf WrapFunc
	if wrapFunc == nil {
		wf = identity
	}
	return h.Div(
		m.first.View(rootUpdateFunc, firstWrapper(m, wf)),
		m.last.View(rootUpdateFunc, lastWrapper(m, wf)),
		h.Button(h.Text("Reset All")).OnClick(rootUpdateFunc, wrapper(m, wf), ResetAll),
		h.Button(h.Text("Randomize All")).OnClick(rootUpdateFunc, wrapper(m, wf), RandomizeAll),
	)
}
コード例 #4
3
ファイル: counter.go プロジェクト: gmlewis/go-frp
func (m Model) View(rootUpdateFunc interface{}, wrapFunc WrapFunc) h.HTML {
	style := [][]string{
		{"font-size", "20px"},
		{"font-family", "monospace"},
		{"display", "inline-block"},
		{"width", "50px"},
		{"text-align", "center"},
	}
	return h.Div(
		h.Button(h.Text("-")).OnClick(rootUpdateFunc, wrapper(m, wrapFunc), Decrement),
		h.Div(h.Text(m.String())).Style(style),
		h.Button(h.Text("+")).OnClick(rootUpdateFunc, wrapper(m, wrapFunc), Increment),
	)
}
コード例 #5
1
ファイル: counterpair.go プロジェクト: gmlewis/go-frp
func (m Model) View(rootUpdateFunc interface{}, wrapFunc WrapFunc) h.HTML {
	return h.Div(
		m.top.View(rootUpdateFunc, topWrapper(m, wrapFunc)),
		m.bottom.View(rootUpdateFunc, bottomWrapper(m, wrapFunc)),
		h.Button(h.Text("Reset")).OnClick(rootUpdateFunc, wrapper(m, wrapFunc), Reset),
	)
}