refactor(styles): Add styles.text

This commit is contained in:
Noah 2024-03-19 18:30:36 -05:00
parent 62982c63d8
commit 1209ca1310
3 changed files with 8 additions and 5 deletions

View File

@ -25,9 +25,9 @@ type IndicatorInfo struct {
func (i IndicatorInfo) String() string {
if i.duration == 0 {
return textStyle.Render(strings.Repeat(".", 30))
return styles.text.Render(strings.Repeat(".", 30))
}
return fmt.Sprintf("%s %s", textStyle.Render(i.duration.String()), i.info)
return fmt.Sprintf("%s %s", styles.text.Render(i.duration.String()), i.info)
}
func initialIndicator(text string) Indicator {

View File

@ -10,6 +10,7 @@ type Colors struct {
}
type Styles struct {
text lipgloss.Style
}
var colors = Colors{
@ -26,3 +27,7 @@ var colors = Colors{
lipgloss.Color("#939ab7"),
},
}
var styles = Styles{
text: lipgloss.NewStyle().Foreground(colors.surface[2]),
}

View File

@ -59,8 +59,6 @@ func getTimeLogs(since time.Time, on_process_repo func(repo gitea.Repository, to
return times
}
var textStyle = lipgloss.NewStyle().Foreground(colors.surface[2])
type timesviewer struct {
table table.Model
length int
@ -93,7 +91,7 @@ func (m timesviewer) View() string {
Foreground(colors.overlay[0]).
Bold(true)
return m.table.View() +
textStyle.Render("\nUse Up and Down arrows to navigate") +
styles.text.Render("\nUse Up and Down arrows to navigate") +
totalTextStyle.Render(fmt.Sprintf("\nTotal - %s\n", m.total_time.String()))
}