예제 #1
7
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
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
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
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),
	)
}