Skip to content

Commit

Permalink
chore: tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
bashbunni committed Sep 25, 2024
1 parent f1f0c4c commit cae0428
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
14 changes: 10 additions & 4 deletions table/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,18 @@ func (m *Model) SetStyles(s Styles) {
m.table.BorderHeader(s.BorderHeader)
}

// TODO make this able to be set with same no args as lipgloss.BorderForeground
func (m *Model) SetBorder(top, right, bottom, left bool) {
m.table.
BorderTop(top).
BorderRight(right).
BorderBottom(bottom).
BorderLeft(left)
}

// Option is used to set options in New. For example:
//
// TODO change this to WithRows as the example instead
//
// table := New(WithColumns([]Column{{Title: "ID", Width: 10}}))
// table := New(WithRows([]Row{{"Foo"},{"Bar"},{"Baz"},}))
type Option func(*Model)

// New creates a new model for the table widget.
Expand Down Expand Up @@ -320,7 +327,6 @@ func (m *Model) SetRows(r []Row) {
// TODO should we just deprecate the Row type altogether?
rows := rowToString(r)
m.rows = rows
// TODO test this
m.table.ClearRows()
m.table.Rows(rows...)
}
Expand Down
5 changes: 3 additions & 2 deletions table/table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,9 @@ func TestTableAlignment(t *testing.T) {
WithStyles(s),
)

// unset borders for styling
// TODO maybe do this in View or something instead if border type is hidden?
// unset borders
// TODO I may need to expose this table OR have a helper func, they
// won't be able to do this outside of the library
biscuits.table.
BorderTop(false).
BorderBottom(false).
Expand Down

0 comments on commit cae0428

Please sign in to comment.