mirror of
https://github.com/zoriya/bubbles.git
synced 2026-08-16 01:43:21 +00:00
feat: add BorderHeader to Styles
This commit is contained in:
+12
-11
@@ -113,29 +113,30 @@ func DefaultKeyMap() KeyMap {
|
||||
// Styles contains style definitions for this list component. By default, these
|
||||
// values are generated by DefaultStyles.
|
||||
type Styles struct {
|
||||
// TODO is there a way to extract the border from the style?
|
||||
Border lipgloss.Border
|
||||
// Why doesn't setting the BorderStyle overwrite the default lip gloss table border?
|
||||
BorderStyle lipgloss.Style
|
||||
Header lipgloss.Style
|
||||
Cell lipgloss.Style
|
||||
Selected lipgloss.Style
|
||||
Border lipgloss.Border
|
||||
BorderStyle lipgloss.Style
|
||||
BorderHeader bool
|
||||
Header lipgloss.Style
|
||||
Cell lipgloss.Style
|
||||
Selected lipgloss.Style
|
||||
}
|
||||
|
||||
// DefaultStyles returns a set of default style definitions for this table.
|
||||
func DefaultStyles() Styles {
|
||||
return Styles{
|
||||
BorderStyle: lipgloss.NewStyle().BorderStyle(lipgloss.HiddenBorder()),
|
||||
Selected: lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("212")),
|
||||
Header: lipgloss.NewStyle().Bold(true).Padding(0, 1),
|
||||
Cell: lipgloss.NewStyle().Padding(0, 1),
|
||||
BorderHeader: true,
|
||||
Selected: lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("212")),
|
||||
Header: lipgloss.NewStyle().Bold(true).Padding(0, 1),
|
||||
Cell: lipgloss.NewStyle().Margin(0, 1),
|
||||
}
|
||||
}
|
||||
|
||||
// SetStyles sets the table styles.
|
||||
func (m *Model) SetStyles(s Styles) {
|
||||
m.styles = s
|
||||
m.table.Border(s.Border)
|
||||
m.table.BorderStyle(s.BorderStyle)
|
||||
m.table.BorderHeader(s.BorderHeader)
|
||||
m.table.StyleFunc(func(row, col int) lipgloss.Style {
|
||||
if row == HEADER {
|
||||
return s.Header
|
||||
|
||||
Reference in New Issue
Block a user