diff options
| author | Kyren223 <Kyren223@proton.me> | 2024-11-09 12:16:36 +0200 |
|---|---|---|
| committer | Kyren223 <Kyren223@proton.me> | 2024-11-09 12:16:36 +0200 |
| commit | 8d97e7000c6579180d37c977edf5d071e4ff1219 (patch) | |
| tree | 59639552d8111752f0fc10356221a12544e43afa /internal/client/ui/auth/field | |
| parent | 8118d9265a5d35c84dcf00a454ecf0209a0351ef (diff) | |
feat: finish authentication UI
Diffstat (limited to 'internal/client/ui/auth/field')
| -rw-r--r-- | internal/client/ui/auth/field/field.go | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/internal/client/ui/auth/field/field.go b/internal/client/ui/auth/field/field.go index 4c6ca12..dca4203 100644 --- a/internal/client/ui/auth/field/field.go +++ b/internal/client/ui/auth/field/field.go @@ -19,11 +19,12 @@ type Model struct { concealIcon string icon string - Style lipgloss.Style - FocusedStyle lipgloss.Style - BlurredStyle lipgloss.Style - ErrorStyle lipgloss.Style - HeaderStyle lipgloss.Style + FocusedStyle lipgloss.Style + BlurredStyle lipgloss.Style + FocusedTextStyle lipgloss.Style + BlurredTextStyle lipgloss.Style + ErrorStyle lipgloss.Style + HeaderStyle lipgloss.Style } func New(width int) Model { @@ -52,7 +53,12 @@ func (m Model) View() string { return "" } - style := m.Style + + style := m.BlurredStyle + if m.Input.Focused() { + style = m.FocusedStyle + } + header := m.HeaderStyle.Render(m.Header) if m.Input.Err != nil { error := m.Input.Err.Error() @@ -77,15 +83,15 @@ func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) { } func (m *Model) Focus() tea.Cmd { - m.Input.PromptStyle = m.FocusedStyle - m.Input.TextStyle = m.FocusedStyle + m.Input.PromptStyle = m.FocusedTextStyle + m.Input.TextStyle = m.FocusedTextStyle return m.Input.Focus() } func (m *Model) Blur() { m.Input.Blur() - m.Input.PromptStyle = m.BlurredStyle - m.Input.TextStyle = m.BlurredStyle + m.Input.PromptStyle = m.BlurredTextStyle + m.Input.TextStyle = m.BlurredTextStyle } func (m *Model) SetWidth(width int) { |
