Skip to content

Commit

Permalink
chore: styling changes
Browse files Browse the repository at this point in the history
  • Loading branch information
leg100 committed Jun 20, 2024
1 parent 3b0c0a2 commit 51ab14b
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 22 deletions.
Binary file modified demo/demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified demo/modules_listing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 11 additions & 3 deletions demo/vhs.tape
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,23 @@ Type "m"
Type "v"
# we're taken to the validate task group page
Sleep 0.5s
# enable task info side panel
Type "I"
# preview output for several tasks
Down Sleep 0.5s Down Sleep 0.5s Down Sleep 0.5s
# disable task info side panel
Type "I" Sleep 0.5s

# go back to modules
Type "m"
Type "m" Sleep 0.5s
# show help
Type "?" Sleep 0.5s
# run plan on all modules
Type "p"
# we're taken to the plan task group page
Sleep 0.5s
Sleep 1s
# hide help
Type "?"
# preview output for several tasks
Down Sleep 0.5s Down Sleep 0.5s Down Sleep 0.5s

Expand All @@ -47,7 +55,7 @@ Ctrl+a Sleep 0.5s Type "a"
# accept confirmation
Sleep 0.5s Type "y"
# preview output for several tasks
Sleep 1.5s Down Sleep 0.5s Down Sleep 0.5s Down Sleep 0.5s
Sleep 2s Down Sleep 0.5s Down Sleep 0.5s Down Sleep 0.5s

# go back to modules
Type "m"
Expand Down
2 changes: 1 addition & 1 deletion hacks/watch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

# in foreground, continously run app
while true; do
_build/pug -w ./demos -f tasks -d
_build/pug -w ./demo/configs -d
done
15 changes: 13 additions & 2 deletions internal/tui/color.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,19 @@ var (

LogRecordAttributeKey = lipgloss.AdaptiveColor{Dark: string(White), Light: string(Black)}

HelpKey = Grey
HelpDesc = LightGrey
HelpKey = lipgloss.AdaptiveColor{
Dark: "ff",
Light: "",
}
HelpDesc = lipgloss.AdaptiveColor{
Dark: "248",
Light: "246",
}

InactivePreviewBorder = lipgloss.AdaptiveColor{
Dark: "244",
Light: "250",
}

CurrentBackground = Grey
CurrentForeground = White
Expand Down
10 changes: 5 additions & 5 deletions internal/tui/split/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ type Model[R resource.Resource] struct {
width int

previewBorder lipgloss.Border
previewBorderColor lipgloss.Color
previewBorderColor lipgloss.TerminalColor

// userListHeightAdjustment is the adjustment the user has requested to the
// default height of the list pane.
Expand Down Expand Up @@ -185,16 +185,16 @@ func (m Model[R]) previewHeight() int {
func (m *Model[R]) setBorderStyles() {
if m.previewVisible {
if m.previewFocused {
m.Table.SetBorderStyle(lipgloss.NormalBorder(), tui.LighterGrey)
m.Table.SetBorderStyle(lipgloss.NormalBorder(), tui.InactivePreviewBorder)
m.previewBorder = lipgloss.ThickBorder()
m.previewBorderColor = tui.Blue
} else {
m.Table.SetBorderStyle(lipgloss.ThickBorder(), tui.Black)
m.Table.SetBorderStyle(lipgloss.ThickBorder(), tui.Blue)
m.previewBorder = lipgloss.NormalBorder()
m.previewBorderColor = tui.LighterGrey
m.previewBorderColor = tui.InactivePreviewBorder
}
} else {
m.Table.SetBorderStyle(lipgloss.NormalBorder(), tui.Black)
m.Table.SetBorderStyle(lipgloss.NormalBorder(), tui.White)
}
}

Expand Down
3 changes: 0 additions & 3 deletions internal/tui/style.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ var (
Border = Regular.Copy().Border(lipgloss.NormalBorder())
ThickBorder = Regular.Copy().Border(lipgloss.ThickBorder()).BorderForeground(Violet)

ActiveBorder = ThickBorder.Copy()
InactiveBorder = Border.Copy().BorderForeground(LighterGrey)

Title = Bold.Copy().Padding(0, 1).Background(Pink).Foreground(White)
TitleCommand = Padded.Copy().Foreground(White).Background(Blue)
TitlePath = Padded.Copy().Foreground(White).Background(modulePathColor)
Expand Down
4 changes: 2 additions & 2 deletions internal/tui/table/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type Model[V resource.Resource] struct {
focus bool

border lipgloss.Border
borderColor lipgloss.Color
borderColor lipgloss.TerminalColor

cursorRow int
cursorID resource.ID
Expand Down Expand Up @@ -308,7 +308,7 @@ func (m Model[V]) View() string {
)
}

func (m *Model[V]) SetBorderStyle(border lipgloss.Border, color lipgloss.Color) {
func (m *Model[V]) SetBorderStyle(border lipgloss.Border, color lipgloss.TerminalColor) {
m.border = border
m.borderColor = color
}
Expand Down
12 changes: 6 additions & 6 deletions internal/tui/top/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,8 @@ func (m model) View() string {
Background(tui.EvenLighterGrey).
Render(m.info)
}
workdir := tui.Padded.Copy().Background(tui.Grey).Foreground(tui.White).Render(m.workdir)
version := tui.Padded.Copy().Background(tui.Black).Foreground(tui.White).Render(version.Version)
workdir := tui.Padded.Copy().Background(tui.LightGrey).Foreground(tui.White).Render(m.workdir)
version := tui.Padded.Copy().Background(tui.DarkGrey).Foreground(tui.White).Render(version.Version)
// Fill in left over space with background color
leftover = m.width - tui.Width(footer) - tui.Width(workdir) - tui.Width(version)
footer += tui.Regular.Copy().Width(leftover).Background(tui.EvenLighterGrey).Render()
Expand Down Expand Up @@ -437,8 +437,8 @@ func (m model) help() string {
descs []string
)
for j := i; j < min(i+rows, len(bindings)); j++ {
keys = append(keys, bindings[j].Help().Key)
descs = append(descs, bindings[j].Help().Desc)
keys = append(keys, helpKeyStyle.Render(bindings[j].Help().Key))
descs = append(descs, helpDescStyle.Render(bindings[j].Help().Desc))
}
// Render pair of columns; beyond the first pair, render a three space
// left margin, in order to visually separate the pairs.
Expand All @@ -447,8 +447,8 @@ func (m model) help() string {
cols = []string{" "}
}
cols = append(cols,
helpKeyStyle.Render(strings.Join(keys, "\n")),
helpDescStyle.Render(strings.Join(descs, "\n")),
strings.Join(keys, "\n"),
strings.Join(descs, "\n"),
)

pair := lipgloss.JoinHorizontal(lipgloss.Top, cols...)
Expand Down

0 comments on commit 51ab14b

Please sign in to comment.