feat: Initial view controller dependency and snapshot tests.

This commit is contained in:
2025-01-23 10:57:20 -05:00
parent c74433c2eb
commit 5695d0e13c
49 changed files with 2802 additions and 1 deletions

View File

@@ -0,0 +1,51 @@
import Elementary
import ElementaryHTMX
import SharedModels
struct EmployeeTable: HTML {
let employees: [Employee]
var content: some HTML {
table {
thead {
tr {
th { "Name" }
th(.style("width: 100px;")) {
Button.add()
.attributes(
.style("padding: 0px 10px;"),
.hx.get(route: .employee(.form)),
.hx.target(.id(.float)),
.hx.swap(.outerHTML.transition(true).swap("0.5s"))
)
}
}
}
tbody(.id(.employee(.table))) {
for employee in employees {
Row(employee: employee)
}
}
}
}
struct Row: HTML {
let employee: Employee
var content: some HTML {
tr(.id(.employee(.row(id: employee.id)))) {
td { employee.fullName }
td {
Button.detail()
.attributes(
.style("padding-left: 15px;"),
.hx.get(route: .employee(.get(id: employee.id))),
.hx.target(.id(.float)),
.hx.pushURL(true),
.hx.swap(.outerHTML.transition(true).swap("0.5s"))
)
}
}
}
}
}