Unify styles

This commit is contained in:
Martin Pander
2026-02-17 21:25:14 +01:00
parent 1a9fd9b4b0
commit 3ab26f658d
10 changed files with 132 additions and 324 deletions

View File

@@ -65,16 +65,9 @@ func NewContextPickerPage(common *common.Common) *ContextPickerPage {
func (p *ContextPickerPage) SetSize(width, height int) {
p.common.SetSize(width, height)
// Set list size with some padding/limits to look like a picker
listWidth := width - 4
if listWidth > 40 {
listWidth = 40
}
listHeight := height - 6
if listHeight > 20 {
listHeight = 20
}
p.picker.SetSize(listWidth, listHeight)
// Use shared modal sizing logic
modalWidth, modalHeight := p.common.Styles.GetModalSize(width, height)
p.picker.SetSize(modalWidth-2, modalHeight-2)
}
func (p *ContextPickerPage) Init() tea.Cmd {
@@ -124,20 +117,23 @@ func (p *ContextPickerPage) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
}
func (p *ContextPickerPage) View() string {
width := p.common.Width() - 4
if width > 40 {
width = 40
}
modalWidth, modalHeight := p.common.Styles.GetModalSize(p.common.Width(), p.common.Height())
content := p.picker.View()
styledContent := lipgloss.NewStyle().Width(width).Render(content)
styledContent := lipgloss.NewStyle().
Width(modalWidth).
Height(modalHeight).
Border(lipgloss.RoundedBorder()).
BorderForeground(p.common.Styles.Palette.Border.GetForeground()).
Padding(0, 1).
Render(content)
return lipgloss.Place(
p.common.Width(),
p.common.Height(),
lipgloss.Center,
lipgloss.Center,
p.common.Styles.Base.Render(styledContent),
styledContent,
)
}