Работа над viewport формы, добавление описания для поля формы, комментарии к fileSelect модели

This commit is contained in:
XeRo 2026-01-19 17:44:49 +05:00
parent ecc89e34c5
commit c7ff7662ba
9 changed files with 333 additions and 207 deletions

View file

@ -1,18 +1,21 @@
package fields
import (
"fmt"
tea "github.com/charmbracelet/bubbletea"
)
type CheckboxModel struct {
Label string
Checked bool
Label string
description string
Checked bool
}
func NewCheckboxModel(label string, checked bool) *CheckboxModel {
func NewCheckboxModel(label, description string, checked bool) *CheckboxModel {
return &CheckboxModel{
Label: label,
Checked: checked,
Label: label,
description: description,
Checked: checked,
}
}
@ -39,6 +42,9 @@ func (m *CheckboxModel) View() string {
} else {
res += "[ ]"
}
if m.description != "" {
res += fmt.Sprintf("\n%s", m.description)
}
return res
}