[WIP] table formatting
This commit is contained in:
@ -2,8 +2,12 @@ package common
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log/slog"
|
||||
"os"
|
||||
|
||||
"tasksquire/taskwarrior"
|
||||
|
||||
"golang.org/x/term"
|
||||
)
|
||||
|
||||
type Common struct {
|
||||
@ -31,6 +35,8 @@ func NewCommon(ctx context.Context, tw taskwarrior.TaskWarrior) *Common {
|
||||
func (c *Common) SetSize(width, height int) {
|
||||
c.width = width
|
||||
c.height = height
|
||||
physicalWidth, physicalHeight, _ := term.GetSize(int(os.Stdout.Fd()))
|
||||
slog.Info("SetSize", "width", width, "height", height, "physicalWidth", physicalWidth, "physicalHeight", physicalHeight)
|
||||
}
|
||||
|
||||
func (c *Common) Width() int {
|
||||
|
||||
@ -7,16 +7,19 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
// "github.com/charmbracelet/bubbles/table"
|
||||
"github.com/charmbracelet/huh"
|
||||
"github.com/charmbracelet/lipgloss"
|
||||
|
||||
"tasksquire/components/table"
|
||||
"tasksquire/taskwarrior"
|
||||
)
|
||||
|
||||
type Styles struct {
|
||||
Main lipgloss.Style
|
||||
|
||||
Form *huh.Theme
|
||||
Form *huh.Theme
|
||||
TableStyle table.Styles
|
||||
|
||||
Active lipgloss.Style
|
||||
Alternate lipgloss.Style
|
||||
@ -71,6 +74,13 @@ func NewStyles(config *taskwarrior.TWConfig) *Styles {
|
||||
styles := parseColors(config.GetConfig())
|
||||
styles.Main = lipgloss.NewStyle()
|
||||
|
||||
styles.TableStyle = table.Styles{
|
||||
// Header: lipgloss.NewStyle().Bold(true).Padding(0, 1).BorderBottom(true),
|
||||
Cell: lipgloss.NewStyle().Padding(0, 1, 0, 0),
|
||||
Header: lipgloss.NewStyle().Bold(true).Padding(0, 1, 0, 0).Underline(true),
|
||||
Selected: lipgloss.NewStyle().Foreground(styles.Active.GetForeground()).Background(styles.Active.GetBackground()).Bold(true).Reverse(true),
|
||||
}
|
||||
|
||||
formTheme := huh.ThemeBase()
|
||||
formTheme.Focused.Title = formTheme.Focused.Title.Bold(true)
|
||||
formTheme.Focused.SelectSelector = formTheme.Focused.SelectSelector.SetString("> ")
|
||||
|
||||
Reference in New Issue
Block a user