From 7308c9388e14f7bc0c923e657f3e8d9b17909509 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=83=9E=E3=83=AA=E3=82=A6=E3=82=B9?= Date: Sat, 31 Dec 2022 11:55:06 -0500 Subject: [PATCH] Adjusted UI and colors --- ui/views/posts/posts.go | 56 +++++++++++++++++++++++++++-------------- 1 file changed, 37 insertions(+), 19 deletions(-) diff --git a/ui/views/posts/posts.go b/ui/views/posts/posts.go index c38c752..2bc66d0 100644 --- a/ui/views/posts/posts.go +++ b/ui/views/posts/posts.go @@ -16,12 +16,24 @@ import ( "github.com/mrusme/gobbs/ui/helpers" ) +var ( + ViewBorderColor = lipgloss.AdaptiveColor{ + Light: "#b0c4de", + Dark: "#b0c4de", + } + + DialogBorderColor = lipgloss.AdaptiveColor{ + Light: "#b0c4de", + Dark: "#b0c4de", + } +) + var ( listStyle = lipgloss.NewStyle(). Margin(0, 0, 0, 0). Padding(1, 1). Border(lipgloss.DoubleBorder()). - BorderForeground(lipgloss.Color("#874BFD")). + BorderForeground(ViewBorderColor). BorderTop(true). BorderLeft(true). BorderRight(true). @@ -36,25 +48,26 @@ var ( BorderBottom(false) dialogBoxStyle = lipgloss.NewStyle(). - Border(lipgloss.NormalBorder()). - BorderForeground(lipgloss.Color("#874BFD")). - Padding(1, 0). - BorderTop(true). + Border(lipgloss.ThickBorder()). + BorderForeground(DialogBorderColor). + Padding(0, 0). + Margin(0, 0, 0, 0). + BorderTop(false). BorderLeft(true). BorderRight(true). BorderBottom(true) - buttonStyle = lipgloss.NewStyle(). - Foreground(lipgloss.Color("#FFF7DB")). - Background(lipgloss.Color("#888B7E")). - Padding(0, 3). - MarginTop(1) + dialogBoxTitlebarStyle = lipgloss.NewStyle(). + Align(lipgloss.Center). + Background(lipgloss.Color("#87cefa")). + Foreground(lipgloss.Color("#000000")). + Padding(0, 1). + Margin(0, 0, 1, 0) - activeButtonStyle = buttonStyle.Copy(). - Foreground(lipgloss.Color("#FFF7DB")). - Background(lipgloss.Color("#F25D94")). - MarginRight(2). - Underline(true) + dialogBoxBottombarStyle = lipgloss.NewStyle(). + Foreground(lipgloss.Color("#999999")). + Padding(0, 1). + Margin(1, 0, 0, 0) postAuthorStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("#F25D94")). @@ -199,14 +212,19 @@ func (m Model) View() string { )) if m.viewportOpen { - okButton := activeButtonStyle.Render("[R]eply") - cancelButton := buttonStyle.Render("Close") + titlebar := dialogBoxTitlebarStyle. + Width(m.viewport.Width + 4). + Render("Post") + + bottombar := dialogBoxBottombarStyle. + Width(m.viewport.Width + 4). + Render("r reply ยท esc close") - buttons := lipgloss.JoinHorizontal(lipgloss.Top, okButton, cancelButton) ui := lipgloss.JoinVertical( lipgloss.Center, + titlebar, viewportStyle.Render(m.viewport.View()), - buttons, + bottombar, ) return helpers.PlaceOverlay(3, 2, dialogBoxStyle.Render(ui), view.String())