Skip to content

Commit

Permalink
refactor(hdom-components): remove obsolete pager defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed May 13, 2020
1 parent 467d33e commit f198835
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions packages/hdom-components/src/pager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,16 +124,12 @@ export interface PagerOpts {
*/
export const pager = (_opts: PagerOpts) => {
const opts = <PagerOpts>{
root: (_, ...body: any[]) => ["div.pager", ...body],
groupPrev: (_, ...bts: any[]) => ["div.pager-prev", ...bts],
groupNext: (_, ...bts: any[]) => ["div.pager-next", ...bts],
groupPages: (_, ...bts: any[]) => ["div.pager-pages", ...bts],
navStep: 1,
labelFirst: "<<",
labelPrev: "<",
labelNext: ">",
labelLast: ">>",
..._opts
..._opts,
};
return (_: any, id: number, num: number, pageLen = 10, maxBts = 5) => {
const bt = opts.button;
Expand All @@ -145,14 +141,14 @@ export const pager = (_opts: PagerOpts) => {
[
opts.groupPrev,
bt(0, id, maxID, opts.labelFirst, !id),
bt(Math.max(id - step!, 0), id, maxID, opts.labelPrev, !id)
bt(Math.max(id - step!, 0), id, maxID, opts.labelPrev, !id),
],
[
opts.groupPages,
map(
(i: number) => bt(i, id, maxID, i + 1, i === id),
pageRange(id, maxID, maxBts)
)
),
],
[
opts.groupNext,
Expand All @@ -163,8 +159,8 @@ export const pager = (_opts: PagerOpts) => {
opts.labelNext,
id >= maxID
),
bt(maxID, id, maxID, opts.labelLast, id >= maxID)
]
bt(maxID, id, maxID, opts.labelLast, id >= maxID),
],
];
};
};
Expand Down

0 comments on commit f198835

Please sign in to comment.