add scroll to top

pull/2456/head
Weihua Lu 2021-07-28 12:19:12 +08:00
parent cc948b5a23
commit fa3f3e8e85
1 changed files with 4 additions and 3 deletions

View File

@ -3,14 +3,13 @@
[clojure.string :as str] [clojure.string :as str]
[frontend.components.svg :as svg] [frontend.components.svg :as svg]
[frontend.extensions.zotero.api :as api] [frontend.extensions.zotero.api :as api]
[frontend.extensions.zotero.extractor :as extractor]
[frontend.extensions.zotero.handler :as zotero-handler] [frontend.extensions.zotero.handler :as zotero-handler]
[frontend.extensions.zotero.setting :as setting] [frontend.extensions.zotero.setting :as setting]
[frontend.handler.notification :as notification] [frontend.handler.notification :as notification]
[frontend.handler.route :as route-handler] [frontend.handler.route :as route-handler]
[frontend.state :as state]
[frontend.ui :as ui] [frontend.ui :as ui]
[frontend.util :as util] [frontend.util :as util]
[goog.dom :as gdom]
[rum.core :as rum])) [rum.core :as rum]))
(def term-chan (chan)) (def term-chan (chan))
@ -81,7 +80,7 @@
(println search-result) (println search-result)
[:div.zotero-search.p-4 [:div#zotero-search.zotero-search.p-4
{:style {:width 600}} {:style {:width 600}}
[:div.flex.items-center.mb-2 [:div.flex.items-center.mb-2
@ -106,12 +105,14 @@
"prev" "prev"
:on-click :on-click
(fn [] (fn []
(set! (.-scrollTop (.-parentNode (gdom/getElement "zotero-search"))) 0)
(go (<! (search-fn prev-search-term prev-page)))))) (go (<! (search-fn prev-search-term prev-page))))))
(when-not (str/blank? next-page) (when-not (str/blank? next-page)
(ui/button (ui/button
"next" "next"
:on-click :on-click
(fn [] (fn []
(set! (.-scrollTop (.-parentNode (gdom/getElement "zotero-search"))) 0)
(go (<! (search-fn prev-search-term next-page))))))]])) (go (<! (search-fn prev-search-term next-page))))))]]))