aprog 1.4.4 → 1.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/Paginate.js +84 -2
package/package.json
CHANGED
package/src/Paginate.js
CHANGED
|
@@ -1,7 +1,80 @@
|
|
|
1
1
|
import {storage} from "./storage.js";
|
|
2
2
|
import {button, div} from "./aprog.js";
|
|
3
3
|
|
|
4
|
-
export const Paginate = ({count = 0, currentPage = 1, onPageChange = () => {}} = {}) => {
|
|
4
|
+
export const Paginate = ({ count = 0, currentPage = 1, onPageChange = () => {}, colors = {} } = {}) => {
|
|
5
|
+
const defaultColors = {
|
|
6
|
+
colorDefault: "#043458",
|
|
7
|
+
colorBackGround: "#ffffff",
|
|
8
|
+
boxShadow: `0 3px 6px 0 rgba(${defaultColors.colorDefault}, 0.4), 0 3px 6px 0 rgba(${defaultColors.colorDefault}, 0.39)`
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const theme = { ...defaultColors, ...colors };
|
|
12
|
+
|
|
13
|
+
const styles = `
|
|
14
|
+
<style>
|
|
15
|
+
.paginate-block {
|
|
16
|
+
width: 100%;
|
|
17
|
+
padding: 0 20px;
|
|
18
|
+
margin: 20px 0;
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
justify-content: center;
|
|
22
|
+
gap: 5px;
|
|
23
|
+
}
|
|
24
|
+
.paginate-btn,
|
|
25
|
+
.paginate-dots,
|
|
26
|
+
.paginate-prev,
|
|
27
|
+
.paginate-next {
|
|
28
|
+
padding: 10px 20px;
|
|
29
|
+
font-size: 14px;
|
|
30
|
+
font-weight: 600;
|
|
31
|
+
color: ${theme.colorDefault};
|
|
32
|
+
background: ${theme.colorBackGround};
|
|
33
|
+
border: 1px solid ${theme.colorDefault};
|
|
34
|
+
border-radius: 8px;
|
|
35
|
+
cursor: pointer;
|
|
36
|
+
box-shadow: ${theme.boxShadow};
|
|
37
|
+
}
|
|
38
|
+
.paginate-prev,
|
|
39
|
+
.paginate-next {
|
|
40
|
+
font-family: Roboto, serif;
|
|
41
|
+
font-weight: 700;
|
|
42
|
+
}
|
|
43
|
+
.paginate-btn.active {
|
|
44
|
+
background: ${theme.colorDefault};
|
|
45
|
+
color: white;
|
|
46
|
+
}
|
|
47
|
+
.paginate-btn:disabled,
|
|
48
|
+
.paginate-dots:disabled,
|
|
49
|
+
.paginate-prev:disabled,
|
|
50
|
+
.paginate-next:disabled {
|
|
51
|
+
cursor: not-allowed;
|
|
52
|
+
opacity: 0.5;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** Counter */
|
|
56
|
+
.counter {
|
|
57
|
+
width: 100%;
|
|
58
|
+
margin: 20px 0;
|
|
59
|
+
padding: 0 20px;
|
|
60
|
+
display: flex;
|
|
61
|
+
align-items: center;
|
|
62
|
+
justify-content: start;
|
|
63
|
+
gap: 20px;
|
|
64
|
+
}
|
|
65
|
+
.counter span {
|
|
66
|
+
padding: 8px 16px;
|
|
67
|
+
border-radius: 8px);
|
|
68
|
+
box-shadow: ${theme.boxShadow};
|
|
69
|
+
cursor: pointer;
|
|
70
|
+
}
|
|
71
|
+
.counter span.active {
|
|
72
|
+
color: ${theme.colorBackGround};
|
|
73
|
+
background-color: ${theme.colorDefault};
|
|
74
|
+
}
|
|
75
|
+
</style>
|
|
76
|
+
`;
|
|
77
|
+
|
|
5
78
|
const generatePageButtons = () => {
|
|
6
79
|
const buttons = [];
|
|
7
80
|
if (count <= 5) {
|
|
@@ -54,8 +127,17 @@ export const Paginate = ({count = 0, currentPage = 1, onPageChange = () => {}} =
|
|
|
54
127
|
// );
|
|
55
128
|
|
|
56
129
|
return div({
|
|
57
|
-
|
|
130
|
+
style: {
|
|
131
|
+
width: "100%",
|
|
132
|
+
padding: "0 20px",
|
|
133
|
+
margin: "20px 0",
|
|
134
|
+
display: "flex",
|
|
135
|
+
alignItems: "center",
|
|
136
|
+
justifyContent: "center",
|
|
137
|
+
gap: "5px"
|
|
138
|
+
},
|
|
58
139
|
value: [
|
|
140
|
+
[styles],
|
|
59
141
|
button({
|
|
60
142
|
class: "paginate-prev",
|
|
61
143
|
value: "<<<",
|