Pagination: add cursor pointer for buttons;

scroll to top when changing page
This commit is contained in:
Vitaliy Vlasov 2018-01-19 15:41:33 +02:00
parent 7d7d781f06
commit 03ab5b0539
4 changed files with 23 additions and 8 deletions

View File

@ -59,6 +59,7 @@
(defn activity-list [activity-page-data]
[:div.ui.container.activity-container
{:id "activity-container"}
(if (empty? (:items activity-page-data))
[:div.view-no-data-container
[:p "No recent activity yet"]]

View File

@ -47,15 +47,16 @@
(defn bounties-list [{:keys [items item-count page-number total-count]
:as bounty-page-data}]
[:div.ui.container.open-bounties-container
{:id "open-bounties-container"}
[:div.open-bounties-header "Bounties"]
(if (empty? items)
[:div.view-no-data-container
[:p "No recent activity yet"]]
[:div
[:div
(let [left (inc (* (dec page-number) items-per-page))
right (dec (+ left item-count))]
[:div.item-counts-label
[:span (str "Showing " left "-" right " of " total-count)]])
[:span (str "Showing " left "-" right " of " total-count)]])
(display-data-page bounty-page-data bounty-item :set-bounty-page-number)])])
(defn bounties-page []

View File

@ -6,6 +6,7 @@
reg-fx
inject-cofx]]
[ajax.core :refer [GET POST]]
[clojure.browser.dom :as dom :refer [get-element]]
[cuerdas.core :as str]
[cljs-web3.core :as web3]
[cljs-web3.eth :as web3-eth]
@ -38,6 +39,15 @@
(println "redirecting to" path)
(set! (.-pathname js/location) path)))
(reg-fx
:bounty-scroll-pos
(fn [scroll-pos]
(.scrollIntoView (get-element "open-bounties-container")) ))
(reg-fx
:activity-scroll-pos
(fn [scroll-pos]
(.scrollIntoView (get-element "activity-container"))))
(reg-event-fx
:initialize-db
@ -68,15 +78,17 @@
(fn [db [_ page]]
(assoc db :page page)))
(reg-event-db
(reg-event-fx
:set-bounty-page-number
(fn [db [_ page]]
(assoc db :bounty-page-number page)))
(fn [{:keys [db]} [_ page]]
{:db (assoc db :bounty-page-number page)
:bounty-scroll-pos 0}))
(reg-event-db
(reg-event-fx
:set-activity-page-number
(fn [db [_ page]]
(assoc db :activity-page-number page)))
(fn [{:keys [db]} [_ page]]
{:db (assoc db :activity-page-number page)
:activity-scroll-pos 0}))
(reg-event-fx
:set-flash-message

View File

@ -887,6 +887,7 @@ body {
flex: none;
align-items: center;
justify-content: center;
cursor: pointer;
}
.grayed-out {