feat: Updates button styles.
This commit is contained in:
@@ -29,7 +29,10 @@ struct EffectiveLengthsView: HTML, Sendable {
|
||||
Row {
|
||||
h1(.class("text-2xl font-bold")) { "Equivalent Lengths" }
|
||||
PlusButton()
|
||||
.attributes(.showModal(id: EffectiveLengthForm.id(nil)))
|
||||
.attributes(
|
||||
.class("btn-ghost"),
|
||||
.showModal(id: EffectiveLengthForm.id(nil))
|
||||
)
|
||||
}
|
||||
.attributes(.class("pb-6"))
|
||||
|
||||
@@ -131,7 +134,7 @@ struct EffectiveLengthsView: HTML, Sendable {
|
||||
div(.class("join")) {
|
||||
TrashButton()
|
||||
.attributes(
|
||||
.class("join-item"),
|
||||
.class("join-item btn-ghost"),
|
||||
.hx.delete(
|
||||
route: .project(
|
||||
.detail(
|
||||
@@ -146,7 +149,7 @@ struct EffectiveLengthsView: HTML, Sendable {
|
||||
)
|
||||
EditButton()
|
||||
.attributes(
|
||||
.class("join-item"),
|
||||
.class("join-item btn-ghost"),
|
||||
.showModal(id: EffectiveLengthForm.id(effectiveLength))
|
||||
)
|
||||
}
|
||||
|
||||
@@ -19,12 +19,10 @@ struct ProjectsTable: HTML, Sendable {
|
||||
div(.class("m-6")) {
|
||||
Row {
|
||||
h1(.class("text-2xl font-bold")) { "Projects" }
|
||||
div(
|
||||
.class("tooltip tooltip-left"),
|
||||
.data("tip", value: "Add project")
|
||||
) {
|
||||
Tooltip("Add project") {
|
||||
PlusButton()
|
||||
.attributes(
|
||||
.class("btn-ghost"),
|
||||
.showModal(id: ProjectForm.id)
|
||||
)
|
||||
}
|
||||
@@ -56,25 +54,42 @@ extension ProjectsTable {
|
||||
struct Rows: HTML, Sendable {
|
||||
let projects: Page<Project>
|
||||
|
||||
func tooltipPosition(_ n: Int) -> TooltipPosition {
|
||||
if projects.metadata.page == 1 && projects.items.count == 1 {
|
||||
return .left
|
||||
} else if n == (projects.items.count - 1) {
|
||||
return .left
|
||||
} else {
|
||||
return .bottom
|
||||
}
|
||||
}
|
||||
|
||||
var body: some HTML {
|
||||
for project in projects.items {
|
||||
for (n, project) in projects.items.enumerated() {
|
||||
tr(.id("\(project.id)")) {
|
||||
td { DateView(project.createdAt) }
|
||||
td { "\(project.name)" }
|
||||
td { "\(project.streetAddress)" }
|
||||
td {
|
||||
div(.class("flex justify-end space-x-6")) {
|
||||
TrashButton()
|
||||
.attributes(
|
||||
.hx.delete(route: .project(.delete(id: project.id))),
|
||||
.hx.confirm("Are you sure?"),
|
||||
.hx.target("closest tr")
|
||||
)
|
||||
a(
|
||||
.class("btn btn-success btn-circle dark:text-white"),
|
||||
.href(route: .project(.detail(project.id, .index())))
|
||||
) {
|
||||
SVG(.chevronRight)
|
||||
div(.class("join")) {
|
||||
Tooltip("Delete project", position: tooltipPosition(n)) {
|
||||
TrashButton()
|
||||
.attributes(
|
||||
.class("join-item btn-ghost"),
|
||||
.hx.delete(route: .project(.delete(id: project.id))),
|
||||
.hx.confirm("Are you sure?"),
|
||||
.hx.target("closest tr")
|
||||
)
|
||||
}
|
||||
Tooltip("View project", position: tooltipPosition(n)) {
|
||||
a(
|
||||
.class("join-item btn btn-success btn-ghost"),
|
||||
.href(route: .project(.detail(project.id, .index())))
|
||||
) {
|
||||
SVG(.chevronRight)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ struct RoomsView: HTML, Sendable {
|
||||
|
||||
Tooltip("Edit SHR") {
|
||||
EditButton()
|
||||
.attributes(.showModal(id: SHRForm.id))
|
||||
.attributes(.class("btn-ghost"), .showModal(id: SHRForm.id))
|
||||
}
|
||||
}
|
||||
.attributes(.class("m-4"))
|
||||
@@ -55,7 +55,7 @@ struct RoomsView: HTML, Sendable {
|
||||
Tooltip("Add Room") {
|
||||
PlusButton()
|
||||
.attributes(
|
||||
.class("mx-auto"),
|
||||
.class("btn-ghost mx-auto"),
|
||||
.showModal(id: RoomForm.id())
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user