Unify styles
This commit is contained in:
@@ -57,16 +57,9 @@ func NewReportPickerPage(common *common.Common, activeReport *taskwarrior.Report
|
||||
func (p *ReportPickerPage) 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 *ReportPickerPage) Init() tea.Cmd {
|
||||
@@ -112,20 +105,23 @@ func (p *ReportPickerPage) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
}
|
||||
|
||||
func (p *ReportPickerPage) 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,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user