-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
118735d
commit 831155b
Showing
13 changed files
with
652 additions
and
235 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
package accounts | ||
|
||
import ( | ||
htmx "github.com/zeiss/fiber-htmx" | ||
"github.com/zeiss/fiber-htmx/components/buttons" | ||
"github.com/zeiss/fiber-htmx/components/forms" | ||
"github.com/zeiss/fiber-htmx/components/links" | ||
"github.com/zeiss/fiber-htmx/components/tables" | ||
"github.com/zeiss/typhoon/internal/api/models" | ||
) | ||
|
||
// AccountsTableProps ... | ||
type AccountsTableProps struct { | ||
Accounts []*models.Account | ||
Offset int | ||
Limit int | ||
Total int | ||
} | ||
|
||
// AccountsTable ... | ||
func AccountsTable(props AccountsTableProps, children ...htmx.Node) htmx.Node { | ||
return htmx.Div( | ||
htmx.ClassNames{ | ||
"bg-base-100": true, | ||
"m-4": true, | ||
}, | ||
tables.Table( | ||
tables.TableProps{ | ||
ID: "accounts-tables", | ||
Toolbar: tables.TableToolbar( | ||
tables.TableToolbarProps{ | ||
ClassNames: htmx.ClassNames{ | ||
"flex": true, | ||
"items-center": true, | ||
"justify-between": true, | ||
"px-5": true, | ||
"pt-5": true, | ||
}, | ||
}, | ||
htmx.Div( | ||
htmx.ClassNames{ | ||
"inline-flex": true, | ||
"items-center": true, | ||
"gap-3": true, | ||
}, | ||
forms.TextInputBordered( | ||
forms.TextInputProps{ | ||
ClassNames: htmx.ClassNames{ | ||
"input-sm": true, | ||
}, | ||
Placeholder: "Search ...", | ||
}, | ||
), | ||
), | ||
htmx.A( | ||
htmx.Href("/accounts/new"), | ||
buttons.Outline( | ||
buttons.ButtonProps{ | ||
ClassNames: htmx.ClassNames{ | ||
"btn-sm": true, | ||
}, | ||
}, | ||
htmx.Text("Create Account"), | ||
), | ||
), | ||
), | ||
}, | ||
[]tables.ColumnDef[*models.Account]{ | ||
{ | ||
ID: "id", | ||
AccessorKey: "id", | ||
Header: func(p tables.TableProps) htmx.Node { | ||
return htmx.Th(htmx.Text("ID")) | ||
}, | ||
Cell: func(p tables.TableProps, row *models.Account) htmx.Node { | ||
return htmx.Td( | ||
htmx.Text(row.ID.String()), | ||
) | ||
}, | ||
}, | ||
{ | ||
ID: "name", | ||
AccessorKey: "name", | ||
Header: func(p tables.TableProps) htmx.Node { | ||
return htmx.Th(htmx.Text("Name")) | ||
}, | ||
Cell: func(p tables.TableProps, row *models.Account) htmx.Node { | ||
return htmx.Td( | ||
links.Link( | ||
links.LinkProps{ | ||
Href: "/accounts/" + row.ID.String(), | ||
}, | ||
htmx.Text(row.Name), | ||
), | ||
) | ||
}, | ||
}, | ||
{ | ||
Header: func(p tables.TableProps) htmx.Node { | ||
return nil | ||
}, | ||
Cell: func(p tables.TableProps, row *models.Account) htmx.Node { | ||
return htmx.Td( | ||
buttons.Button( | ||
buttons.ButtonProps{ | ||
ClassNames: htmx.ClassNames{ | ||
"btn-square": true, | ||
}, | ||
}, | ||
), | ||
) | ||
}, | ||
}, | ||
}, | ||
props.Accounts, | ||
// Pagination: ProfileListTablePaginationComponent( | ||
// ProfileListTablePaginationProps{ | ||
// Limit: props.Limit, | ||
// Offset: props.Offset, | ||
// Total: props.Total, | ||
// Target: "profiles-tables", | ||
// Team: props.Team, | ||
// }, | ||
// ), | ||
), | ||
) | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.