35 lines
532 B
Go
35 lines
532 B
Go
package components
|
|
|
|
import (
|
|
tea "charm.land/bubbletea/v2"
|
|
"charm.land/huh/v2"
|
|
)
|
|
|
|
type Page struct {
|
|
form huh.Form
|
|
}
|
|
|
|
type MultiPageForm struct {
|
|
// pages []Page
|
|
form huh.Form
|
|
}
|
|
|
|
func NewMultiPageForm(form huh.Form) *MultiPageForm {
|
|
return &MultiPageForm{
|
|
form: form,
|
|
}
|
|
}
|
|
|
|
func (f *MultiPageForm) Init() tea.Cmd {
|
|
return nil
|
|
}
|
|
|
|
func (f *MultiPageForm) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|
_, cmd := f.form.Update(msg)
|
|
return f, cmd
|
|
}
|
|
|
|
func (f *MultiPageForm) View() tea.View {
|
|
return tea.NewView(f.form.View())
|
|
}
|