mirror of https://github.com/logseq/logseq
enhance: add close button to exit search
parent
de3677ec42
commit
b4c8d8a4a3
|
@ -55,7 +55,7 @@
|
||||||
(ui/icon "arrow-up")
|
(ui/icon "arrow-up")
|
||||||
false
|
false
|
||||||
(ui/icon "arrow-down")
|
(ui/icon "arrow-down")
|
||||||
nil))))
|
[:div {:style {:width 18 :height 18}}]))))
|
||||||
|
|
||||||
(defn- timestamp-cell-cp
|
(defn- timestamp-cell-cp
|
||||||
[_table row column]
|
[_table row column]
|
||||||
|
@ -198,17 +198,24 @@
|
||||||
[input {:keys [on-change]}]
|
[input {:keys [on-change]}]
|
||||||
(let [[show-input? set-show-input!] (rum/use-state false)]
|
(let [[show-input? set-show-input!] (rum/use-state false)]
|
||||||
(if show-input?
|
(if show-input?
|
||||||
(shui/input
|
[:div.flex.flex-row.items-center
|
||||||
{:placeholder "Type to search"
|
(shui/input
|
||||||
:auto-focus true
|
{:placeholder "Type to search"
|
||||||
:value input
|
:auto-focus true
|
||||||
:onChange (fn [e]
|
:value input
|
||||||
(let [value (util/evalue e)]
|
:onChange (fn [e]
|
||||||
(on-change value)))
|
(let [value (util/evalue e)]
|
||||||
:on-key-down (fn [e]
|
(on-change value)))
|
||||||
(when (= "Escape" (util/ekey e))
|
:on-key-down (fn [e]
|
||||||
(set-show-input! false)))
|
(when (= "Escape" (util/ekey e))
|
||||||
:class "max-w-sm !h-7 !py-0 border-none focus-visible:ring-0 focus-visible:ring-offset-0"})
|
(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
|
(shui/button
|
||||||
{:variant "ghost"
|
{:variant "ghost"
|
||||||
;; FIXME: remove ring when focused
|
;; FIXME: remove ring when focused
|
||||||
|
|
Loading…
Reference in New Issue