From 8116f02d63287db396b28f04c735b4d634de4070 Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Mon, 23 May 2022 16:57:22 -0400 Subject: [PATCH] fix: footer padding --- ui/components/footer/footer.go | 6 ++++-- ui/pages/repo/log.go | 25 ++++++++++--------------- ui/styles/styles.go | 3 ++- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/ui/components/footer/footer.go b/ui/components/footer/footer.go index eb97f8b9820780b77975217e62cbb414fe65678f..6d724eb230acdb06052b716e4962484f6daf7c3e 100644 --- a/ui/components/footer/footer.go +++ b/ui/components/footer/footer.go @@ -34,7 +34,8 @@ func New(c common.Common, keymap help.KeyMap) *Footer { // SetSize implements common.Component. func (f *Footer) SetSize(width, height int) { f.common.SetSize(width, height) - f.help.Width = width + f.help.Width = width - + f.common.Styles.Footer.GetHorizontalFrameSize() } // Init implements tea.Model. @@ -52,7 +53,8 @@ func (f *Footer) View() string { if f.keymap == nil { return "" } - s := f.common.Styles.Footer.Copy().Width(f.common.Width) + s := f.common.Styles.Footer.Copy(). + Width(f.common.Width) helpView := f.help.View(f.keymap) return s.Render(helpView) } diff --git a/ui/pages/repo/log.go b/ui/pages/repo/log.go index 8eabe8d65baf782b6d9189e64b5d80cc7d833086..7611bff20fd4322eb8eed509d83ff013ab9eee0c 100644 --- a/ui/pages/repo/log.go +++ b/ui/pages/repo/log.go @@ -7,7 +7,6 @@ import ( "github.com/charmbracelet/bubbles/key" tea "github.com/charmbracelet/bubbletea" - "github.com/charmbracelet/glamour" gansi "github.com/charmbracelet/glamour/ansi" "github.com/charmbracelet/lipgloss" ggit "github.com/charmbracelet/soft-serve/git" @@ -277,10 +276,15 @@ func (l *Log) StatusBarValue() string { if c == nil { return "" } - return fmt.Sprintf("%s by %s", - c.ID.String(), - fmt.Sprintf("%s <%s>", c.Author.Name, c.Author.Email), - ) + who := c.Author.Name + if email := c.Author.Email; email != "" { + who += " <" + email + ">" + } + value := c.ID.String() + if who != "" { + value += " by " + who + } + return value } // StatusBarInfo returns the status bar info. @@ -348,19 +352,10 @@ func (l *Log) loadDiffCmd() tea.Msg { return LogDiffMsg(diff) } -func styleConfig() gansi.StyleConfig { - noColor := "" - s := glamour.DarkStyleConfig - s.Document.StylePrimitive.Color = &noColor - s.CodeBlock.Chroma.Text.Color = &noColor - s.CodeBlock.Chroma.Name.Color = &noColor - return s -} - func renderCtx() gansi.RenderContext { return gansi.NewRenderContext(gansi.Options{ ColorProfile: termenv.TrueColor, - Styles: styleConfig(), + Styles: common.StyleConfig(), }) } diff --git a/ui/styles/styles.go b/ui/styles/styles.go index ee783af0c2e17e1ab5db1e56a38ef1d218afef8e..b71cfbce9bfb87c0e65d16869624883449a86373 100644 --- a/ui/styles/styles.go +++ b/ui/styles/styles.go @@ -208,10 +208,11 @@ func DefaultStyles() *Styles { Bold(true) s.RepoHeaderDesc = lipgloss.NewStyle(). + Faint(true). Foreground(lipgloss.Color("15")) s.Footer = lipgloss.NewStyle(). - PaddingLeft(1). + Padding(0, 1). Height(1) s.Branch = lipgloss.NewStyle().