Просмотр исходного кода

feat(ui): set Box.titleAlign to left

rigormorrtiss 4 лет назад
Родитель
Сommit
0c47002c9e
4 измененных файлов с 6 добавлено и 24 удалено
  1. 0 20
      ui/dropdowns.go
  2. 2 2
      ui/inputfields.go
  3. 2 1
      ui/textviews.go
  4. 2 1
      ui/treeviews.go

+ 0 - 20
ui/dropdowns.go

@@ -1,20 +0,0 @@
-package ui
-
-import (
-	"github.com/gdamore/tcell/v2"
-	"github.com/rigormorrtiss/discordo/util"
-	"github.com/rivo/tview"
-)
-
-func NewGuildsDropDown(onGuildsDropDownSelected func(string, int), theme *util.Theme) (d *tview.DropDown) {
-	d = tview.NewDropDown()
-	d.
-		SetLabel("Guild: ").
-		SetSelectedFunc(onGuildsDropDownSelected).
-		SetFieldBackgroundColor(tcell.GetColor(theme.DropDownBackground)).
-		SetBackgroundColor(tcell.GetColor(theme.DropDownBackground)).
-		SetBorder(true).
-		SetBorderPadding(0, 0, 1, 1)
-
-	return
-}

+ 2 - 2
ui/inputfields.go

@@ -13,9 +13,9 @@ func NewMessageInputField(onMessageInputFieldInputCapture func(*tcell.EventKey)
 		SetPlaceholderTextColor(tcell.ColorWhite).
 		SetFieldBackgroundColor(tcell.GetColor(theme.InputFieldBackground)).
 		SetBackgroundColor(tcell.GetColor(theme.InputFieldBackground)).
+		SetInputCapture(onMessageInputFieldInputCapture).
 		SetBorder(true).
-		SetBorderPadding(0, 0, 1, 1).
-		SetInputCapture(onMessageInputFieldInputCapture)
+		SetBorderPadding(0, 0, 1, 1)
 
 	return
 }

+ 2 - 1
ui/textviews.go

@@ -17,7 +17,8 @@ func NewMessagesTextView(app *tview.Application, theme *util.Theme) (textV *tvie
 		}).
 		SetBackgroundColor(tcell.GetColor(theme.TextViewBackground)).
 		SetBorder(true).
-		SetBorderPadding(0, 0, 1, 1)
+		SetBorderPadding(0, 0, 1, 1).
+		SetTitleAlign(tview.AlignLeft)
 
 	return
 }

+ 2 - 1
ui/treeviews.go

@@ -17,7 +17,8 @@ func NewGuildsTreeView(onGuildsTreeViewSelected func(*tview.TreeNode), theme *ut
 		SetBackgroundColor(tcell.GetColor(theme.TreeViewBackground)).
 		SetTitle("Guilds").
 		SetBorder(true).
-		SetBorderPadding(0, 0, 1, 1)
+		SetBorderPadding(0, 0, 1, 1).
+		SetTitleAlign(tview.AlignLeft)
 
 	return
 }