Wow squint with clojure http-kit is so great 😄. i can now write everything on the server 😄. That can't be done with htmx.
We need a blog post about this ;)
I'll do my best 😄 currently i have to finish my tool 😄
(defn ->js [form]
(->>
(squint/compile-string* (str form))
:body))
(defn button->modal [& {:keys [path name id label header content] :as opts}]
(let [dialog-id (str name "-" id)
show-dialog (->js `(.showModal (document.getElementById ~dialog-id)))
close-dialog (->js `(.close (document.getElementById ~dialog-id)))]
[:div
[:a {:onclick show-dialog} label]
[:dialog {:id (str name "-" id)}
[:article
[:header
[:button {:aria-label "Close" :rel "prev" :onclick close-dialog}]
[:p [:strong header]]]
content
[:div
[:a {:role "button" :onclick close-dialog} "Close"]]]]]))
Here a "generic" modal component 😄guess i have to create a record for that or use a map instead of the simple attributes
(button->modal
:path (str "/commands/" (:id item))
:name "cmd-delete"
:id (:id item)
:label "Delete"
:header "Delete"
:content [:div
[:a "Hello"]])
Thats how you use itBTW is there a maven supplied squint i can use in deps? currently i use the git version
you can use squint as a git dependency