mirror of
https://github.com/status-im/re-frame-10x.git
synced 2025-01-27 06:34:59 +00:00
Refactor autoscrolling code
This commit is contained in:
parent
d5aefa9b1d
commit
6276a76cbb
@ -227,7 +227,7 @@
|
||||
(:filter-type item) ": " [:span.filter-item-string (:query item)]
|
||||
[:span.icon-button [components/icon-remove]]]])
|
||||
@filter-items)]]
|
||||
[components/autoscroll-list {:class "panel-content-scrollable" :scroll? true}
|
||||
[components/autoscroll-list {:class "panel-content-scrollable"}
|
||||
[:table
|
||||
{:style {:margin-bottom 10}
|
||||
:cell-spacing "0" :width "100%"}
|
||||
|
@ -23,7 +23,7 @@
|
||||
;; at-end?: element.scrollHeight - element.scrollTop === element.clientHeight
|
||||
(> tolerance (- (.-scrollHeight el) (.-scrollTop el) (.-clientHeight el))))
|
||||
|
||||
(defn autoscroll-list [{:keys [class scroll?] :as opts} childr]
|
||||
(defn autoscroll-list [{:keys [class]} child]
|
||||
(let [should-scroll (r/atom true)]
|
||||
(r/create-class
|
||||
{:display-name "autoscroll-list"
|
||||
@ -37,9 +37,8 @@
|
||||
(reset! should-scroll (scrolled-to-end? n 100))))
|
||||
:component-did-update
|
||||
(fn [this]
|
||||
(let [scroll? (:scroll? (r/props this))
|
||||
n (r/dom-node this)]
|
||||
(when (and scroll? @should-scroll)
|
||||
(let [n (r/dom-node this)]
|
||||
(when @should-scroll
|
||||
(scroll! n [0 (.-scrollTop n)] [0 (.-scrollHeight n)] 1600))))
|
||||
:reagent-render
|
||||
(fn [{:keys [class]} child]
|
||||
|
@ -95,7 +95,7 @@
|
||||
flex: 1;
|
||||
}
|
||||
#--re-frame-trace-- .panel-content-scrollable {
|
||||
margin: 10px;
|
||||
margin: 0 0 10px 5px;
|
||||
overflow: auto;
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user