enhance: add close button to exit search

feat/tables
Tienson Qin 2024-07-02 10:08:11 +08:00
parent de3677ec42
commit b4c8d8a4a3
1 changed files with 19 additions and 12 deletions

View File

@ -55,7 +55,7 @@
(ui/icon "arrow-up")
false
(ui/icon "arrow-down")
nil))))
[:div {:style {:width 18 :height 18}}]))))
(defn- timestamp-cell-cp
[_table row column]
@ -198,6 +198,7 @@
[input {:keys [on-change]}]
(let [[show-input? set-show-input!] (rum/use-state false)]
(if show-input?
[:div.flex.flex-row.items-center
(shui/input
{:placeholder "Type to search"
:auto-focus true
@ -209,6 +210,12 @@
(when (= "Escape" (util/ekey e))
(set-show-input! false)))
:class "max-w-sm !h-7 !py-0 border-none focus-visible:ring-0 focus-visible:ring-offset-0"})
(shui/button
{:variant "ghost"
:class "text-muted-foreground !px-1"
:size :sm
:on-click #(set-show-input! false)}
(ui/icon "x"))]
(shui/button
{:variant "ghost"
;; FIXME: remove ring when focused