Maybe using new datepicker

This commit is contained in:
2023-09-27 09:03:16 -07:00
parent 160c289f03
commit c5c752417b
5 changed files with 50 additions and 39 deletions

View File

@@ -1,4 +1,5 @@
(ns auto-ap.ssr.components.inputs)
(ns auto-ap.ssr.components.inputs
(:require [hiccup2.core :as hiccup]))
(defn select- [params & children]
(into
@@ -37,13 +38,17 @@
])
(defn date-input- [{:keys [size] :as params}]
[:input
(-> params
(update
:class str " bg-gray-50 border border-gray-300 text-gray-900 rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500")
(assoc :type "date")
(update :class #(str % (use-size size)))
(dissoc :size))])
[:div
[:input
(-> params
(update
:class str " bg-gray-50 border border-gray-300 text-gray-900 rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500")
(assoc :type "text")
(assoc "_" (hiccup/raw "init initDatepicker(me)"))
(assoc "hx-on" (hiccup/raw "changeDate: htmx.trigger(this, \"change\")
htmx:beforeCleanupElement: this.dp.destroy()"))
(update :class #(str % (use-size size)))
(dissoc :size))]])
(defn field- [params & rest]
(into