Skip to content

Commit 32cdfdb

Browse files
committed
Isolate paginator css and update browse.js
1 parent a13e47a commit 32cdfdb

File tree

3 files changed

+11
-47
lines changed

3 files changed

+11
-47
lines changed

datafiles/static/browse.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -248,14 +248,14 @@ const createPageLink = (num) => {
248248
return a;
249249
};
250250

251-
const createPrevNext = (prevNextNum, cond, txt) => {
252-
const el = d.createElement(cond ? "span" : "a");
251+
const createPrevNext = (prevNextNum, txt) => {
252+
const el = d.createElement("a");
253253
el.setAttribute("href", "#");
254254
el.addEventListener('click', (evt) => {
255255
evt.preventDefault();
256256
changePage(prevNextNum);
257257
});
258-
if (cond) el.classList.add("disabled");
258+
259259
el.appendChild(d.createTextNode(txt));
260260
return el;
261261
};
@@ -271,7 +271,7 @@ const createPaginator = () => {
271271

272272
const pag = d.createElement("div");
273273
pag.classList.add("paginator");
274-
pag.appendChild(createPrevNext(state.page - 1, state.page === 0, "Previous"));
274+
if (state.page !== 0) pag.appendChild(createPrevNext(state.page - 1, "Previous"));
275275
// note that page is zero-indexed
276276
if (maxPage <= 4) {
277277
// No ellipsis
@@ -303,7 +303,8 @@ const createPaginator = () => {
303303
pag.appendChild(createPageLink(maxPage));
304304
}
305305
const isNowOnLastPage = state.page === maxPage;
306-
pag.appendChild(createPrevNext(state.page + 1, isNowOnLastPage, "Next"));
306+
307+
if(!isNowOnLastPage) pag.appendChild(createPrevNext(state.page + 1, "Next"));
307308

308309
return pag;
309310
};

datafiles/static/hackage.css

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,7 +1042,6 @@ a.deprecated[href]:visited {
10421042
}
10431043

10441044
/* Paginator */
1045-
/* Maybe should remove this from browse.html.st */
10461045
#paginatorContainer {
10471046
display: flex;
10481047
align-items: center;
@@ -1085,11 +1084,12 @@ a.deprecated[href]:visited {
10851084
background: linear-gradient(to bottom, #585858 0%, #111 100%);
10861085
}
10871086

1088-
.paginator span {
1089-
padding: 0 1em;
1087+
.paginator a[href][disabled] {
1088+
color: #666;
10901089
cursor: default;
10911090
}
10921091

1093-
.paginator a[disabled], .paginator a[disabled]:hover {
1094-
color: #666;
1092+
.paginator a[href][disabled]:hover {
1093+
background: none;
1094+
border: none;
10951095
}

datafiles/templates/Html/browse.html.st

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -51,38 +51,6 @@
5151
#browseTable th.descending {
5252
background-image: url(/static/images/sort_desc.png);
5353
}
54-
.paginator {
55-
margin-left: auto;
56-
}
57-
.paginator a {
58-
box-sizing: border-box;
59-
display: inline-block;
60-
min-width: 1.5em;
61-
padding: 0.5em 1em;
62-
margin-left: 2px;
63-
text-align: center;
64-
text-decoration: none !important;
65-
color: #333 !important;
66-
border: 1px solid transparent;
67-
border-radius: 2px;
68-
}
69-
.paginator .current, .paginator .current:hover {
70-
color: #333 !important;
71-
border: 1px solid #979797;
72-
background: linear-gradient(to bottom, #fff 0%, #dcdcdc 100%);
73-
}
74-
.paginator a:hover {
75-
color: white !important;
76-
border: 1px solid #111;
77-
background: linear-gradient(to bottom, #585858 0%, #111 100%);
78-
}
79-
.paginator span {
80-
padding: 0 1em;
81-
cursor: default;
82-
}
83-
.paginator .disabled {
84-
color: #666;
85-
}
8654
.filterSuggestion {
8755
display: flex;
8856
align-items: center;
@@ -102,11 +70,6 @@
10270
.filterSuggestion > div > input {
10371
margin: 0;
10472
}
105-
#paginatorContainer {
106-
display: flex;
107-
align-items: center;
108-
flex-wrap: wrap;
109-
}
11073
#fatalError {
11174
display: none;
11275
color: red;

0 commit comments

Comments
 (0)