everything except pagination

This commit is contained in:
Bryce Covert
2020-08-23 07:59:34 -07:00
parent edbc9f85c4
commit 84137161bf
7 changed files with 24 additions and 28 deletions

View File

@@ -1,6 +1,7 @@
(ns auto-ap.views.components.grid
(:require [reagent.core :as r]
[auto-ap.views.utils :refer [appearing]]
[auto-ap.utils :refer [default-pagination-size]]
[react :as react]
[re-frame.core :as re-frame]
[auto-ap.views.pages.data-page :as data-page]))
@@ -54,7 +55,7 @@
y))
(defn paginator [{:keys [start end count total on-change]}]
(let [per-page 100
(let [per-page default-pagination-size
max-buttons 5
buttons-before (Math/floor (/ max-buttons 2))
total-pages (Math/max 1 (Math/ceil (/ total per-page)))
@@ -189,7 +190,7 @@
(cond (= :loading (:state status))
^{:key "loading-body"}
[:tbody.test
(for [i (range 20)]
(for [i (range default-pagination-size)]
^{:key i}
[:tr
(for [x (range column-count)]
@@ -258,9 +259,9 @@
(r/children (r/current-component)))))))
(defn virtual-paginate [start xs ]
(take 100 (drop (or start 0) xs)))
(take default-pagination-size (drop (or start 0) xs)))
(defn virtual-paginate-controls [start xs]
{:start (or start 0) :end (min (+ (or start 0) 100)
{:start (or start 0) :end (min (+ (or start 0) default-pagination-size)
(count xs))
:total (count xs)})