summaryrefslogtreecommitdiff
path: root/internal/slider
diff options
context:
space:
mode:
Diffstat (limited to 'internal/slider')
-rw-r--r--internal/slider/slider.go16
1 files changed, 9 insertions, 7 deletions
diff --git a/internal/slider/slider.go b/internal/slider/slider.go
index a6c6ee6..dbf4093 100644
--- a/internal/slider/slider.go
+++ b/internal/slider/slider.go
@@ -2,6 +2,7 @@ package slider
import (
"fmt"
+ "strings"
"github.com/ChausseBenjamin/termpicker/internal/progress"
"github.com/ChausseBenjamin/termpicker/internal/ui"
@@ -19,11 +20,8 @@ type Model struct {
func New(label byte, maxVal int, opts ...progress.Option) Model {
slider := Model{
- label: label,
- progress: progress.New(
- progress.WithoutPercentage(),
- progress.WithColorProfile(ui.ColorProfile()),
- ),
+ label: label,
+ progress: progress.New(),
max: maxVal,
current: maxVal / 2,
mappings: newKeybinds(),
@@ -34,7 +32,7 @@ func New(label byte, maxVal int, opts ...progress.Option) Model {
return slider
}
-func (m Model) Title() string { return fmt.Sprintf("%c", m.label) }
+func (m Model) Title() string { return fmt.Sprintf("%c:", m.label) }
func (m Model) Init() tea.Cmd {
// Triggering a frame message Update here will force the progress bar to
@@ -81,5 +79,9 @@ func (m Model) ViewValue(current int) string {
}
func (m Model) View() string {
- return fmt.Sprintf("%v: %v %v", m.Title(), m.progress.View(), m.ViewValue(m.current))
+ return strings.Join([]string{
+ ui.Style().SliderLabel.Render(m.Title()),
+ m.progress.View(),
+ ui.Style().SliderVal.Render(m.ViewValue(m.current)),
+ }, " ")
}