feat: Updating id key for usage in views, for typesafe keys

This commit is contained in:
2025-01-19 20:07:32 -05:00
parent 81f0e03549
commit 2de85ed758
13 changed files with 203 additions and 119 deletions

View File

@@ -9,7 +9,7 @@ struct UserTable: HTML {
let users: [User]
var content: some HTML {
table(.id(.user(.table()))) {
table {
thead {
tr {
th { "Username" }
@@ -18,13 +18,13 @@ struct UserTable: HTML {
Button.add()
.attributes(
.hx.get(route: .user(.form)),
.hx.target(.float),
.hx.target(.id(.float)),
.hx.swap(.outerHTML)
)
}
}
}
tbody(.id(.user(.table(.body)))) {
tbody(.id(.user(.table))) {
for user in users {
Row(user: user)
}
@@ -46,7 +46,7 @@ struct UserTable: HTML {
td {
Button.detail().attributes(
.hx.get(route: .user(.get(id: user.id))),
.hx.target(.float),
.hx.target(.id(.float)),
.hx.swap(.outerHTML),
.hx.pushURL(true)
)