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

@@ -1,11 +0,0 @@
import Elementary
extension HTMLAttribute where Tag: HTMLTrait.Attributes.Global {
static var customToggleFloatAfterRequest: Self {
.custom(
name: "hx-on::after-request",
value: "if(event.detail.successful) toggleContent('float')"
)
}
}

View File

@@ -1,4 +1,5 @@
import Elementary
import SharedModels
struct Float<C: HTML, B: HTML>: HTML {
@@ -61,14 +62,17 @@ extension Float where B == DefaultCloseButton {
init(
id: String = "float",
shouldDisplay: Bool,
resetURL: String? = nil,
resetURL route: ViewRoute? = nil,
@HTMLBuilder body: () -> C
) {
self.init(
id: id,
shouldDisplay: shouldDisplay,
body: body,
closeButton: { DefaultCloseButton(id: id, resetURL: resetURL) }
closeButton: { DefaultCloseButton(
id: id,
resetURL: route != nil ? ViewRoute.router.path(for: route!) : nil
) }
)
}