playbook_ui_docs 13.34.1.pre.alpha.pbntr258paginationkitforreact3411 → 13.34.1.pre.alpha.pbntr258paginationkitforreact3413
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_default.jsx +8 -8
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_page_change.jsx +62 -0
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_page_change_react.md +1 -0
- data/app/pb_kits/playbook/pb_pagination/docs/data.js +23 -0
- data/app/pb_kits/playbook/pb_pagination/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_pagination/docs/index.js +1 -0
- data/dist/playbook-doc.js +1 -1
- metadata +5 -2
- /data/app/pb_kits/playbook/pb_pagination/docs/{_pagination_default.md → _pagination_default_rails.md} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f295ceaf7c925c146f404eac99994b1cff46ac282053c418f1d9ff187f9c2b74
|
4
|
+
data.tar.gz: fd5fb198adee2ee685759593074ab31e10fcbba13128b0bd4b7f7fbc22a95590
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a87997f56ff50a3b38153640bddd8d749f4f5b223e8fe210a6e2305b5f977924dce67fe62ff30f366122a53f5427a1777ad1973e7de4d814b3bf5e2e7ee3a7ec
|
7
|
+
data.tar.gz: 6edb081d3d4785686bd0a02519c7911b9492a615589d2d897eb8444fe23a934647063dfcc6003086991873bf4ea3988f0f31503469e2d9fd0304bc59a6219c05
|
@@ -5,14 +5,14 @@ import Pagination from '../_pagination'
|
|
5
5
|
const PaginationDefault = (props) => {
|
6
6
|
|
7
7
|
return (
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
8
|
+
<>
|
9
|
+
<Pagination
|
10
|
+
current={1}
|
11
|
+
range={5}
|
12
|
+
total={10}
|
13
|
+
{...props}
|
14
|
+
/>
|
15
|
+
</>
|
16
16
|
)
|
17
17
|
}
|
18
18
|
|
@@ -0,0 +1,62 @@
|
|
1
|
+
import React, { useState } from "react";
|
2
|
+
import { Table, Pagination } from 'playbook-ui'
|
3
|
+
|
4
|
+
|
5
|
+
import { data } from "./data";
|
6
|
+
|
7
|
+
const PaginationPageChange = (props) => {
|
8
|
+
|
9
|
+
const [activePage, setActivePage] = useState(1);
|
10
|
+
const rowsPerPage = 3;
|
11
|
+
const totalPages = Math.ceil(data.length / rowsPerPage);
|
12
|
+
|
13
|
+
const onPageChange = (pageNumber) => {
|
14
|
+
setActivePage(pageNumber);
|
15
|
+
};
|
16
|
+
|
17
|
+
const currentData = data.slice(
|
18
|
+
(activePage - 1) * rowsPerPage,
|
19
|
+
activePage * rowsPerPage
|
20
|
+
);
|
21
|
+
|
22
|
+
|
23
|
+
return (
|
24
|
+
<div className="App">
|
25
|
+
<Table
|
26
|
+
marginBottom="xs"
|
27
|
+
responsive="none"
|
28
|
+
size="sm"
|
29
|
+
{...props}
|
30
|
+
>
|
31
|
+
<Table.Head>
|
32
|
+
<Table.Row>
|
33
|
+
<Table.Header>{"Column 1"}</Table.Header>
|
34
|
+
<Table.Header>{"Column 2"}</Table.Header>
|
35
|
+
<Table.Header>{"Column 3"}</Table.Header>
|
36
|
+
<Table.Header>{"Column 4"}</Table.Header>
|
37
|
+
<Table.Header>{"Column 5"}</Table.Header>
|
38
|
+
</Table.Row>
|
39
|
+
</Table.Head>
|
40
|
+
<Table.Body>
|
41
|
+
{currentData.map((row, index) => (
|
42
|
+
<Table.Row key={index}>
|
43
|
+
{row.map((cell, cellIndex) => (
|
44
|
+
<Table.Cell key={cellIndex}>{cell}</Table.Cell>
|
45
|
+
))}
|
46
|
+
</Table.Row>
|
47
|
+
))}
|
48
|
+
</Table.Body>
|
49
|
+
</Table>
|
50
|
+
|
51
|
+
<Pagination
|
52
|
+
current={1}
|
53
|
+
onChange={onPageChange}
|
54
|
+
range={5}
|
55
|
+
total={totalPages}
|
56
|
+
{...props}
|
57
|
+
/>
|
58
|
+
</div>
|
59
|
+
)
|
60
|
+
}
|
61
|
+
|
62
|
+
export default PaginationPageChange
|
@@ -0,0 +1 @@
|
|
1
|
+
You can use the `onPageChange` prop to control the data of your table. This prop is callback function that will allow you control the state.
|
@@ -0,0 +1,23 @@
|
|
1
|
+
export const data = [
|
2
|
+
["Value 1", "Value 2", "Value 3", "Value 4", "Value 5"],
|
3
|
+
["Value 6", "Value 7", "Value 8", "Value 9", "Value 10"],
|
4
|
+
["Value 11", "Value 12", "Value 13", "Value 14", "Value 15"],
|
5
|
+
["Value 16", "Value 17", "Value 18", "Value 19", "Value 20"],
|
6
|
+
["Value 21", "Value 22", "Value 23", "Value 24", "Value 25"],
|
7
|
+
["Value 26", "Value 27", "Value 28", "Value 29", "Value 30"],
|
8
|
+
["Value 31", "Value 32", "Value 33", "Value 34", "Value 35"],
|
9
|
+
["Value 36", "Value 37", "Value 38", "Value 39", "Value 40"],
|
10
|
+
["Value 41", "Value 42", "Value 43", "Value 44", "Value 45"],
|
11
|
+
["Value 46", "Value 47", "Value 48", "Value 49", "Value 50"],
|
12
|
+
["Value 51", "Value 52", "Value 53", "Value 54", "Value 55"],
|
13
|
+
["Value 56", "Value 57", "Value 58", "Value 59", "Value 60"],
|
14
|
+
["Value 61", "Value 62", "Value 63", "Value 64", "Value 65"],
|
15
|
+
["Value 66", "Value 67", "Value 68", "Value 69", "Value 70"],
|
16
|
+
["Value 71", "Value 72", "Value 73", "Value 74", "Value 75"],
|
17
|
+
["Value 76", "Value 77", "Value 78", "Value 79", "Value 80"],
|
18
|
+
["Value 81", "Value 82", "Value 83", "Value 84", "Value 85"],
|
19
|
+
["Value 86", "Value 87", "Value 88", "Value 89", "Value 90"],
|
20
|
+
["Value 91", "Value 92", "Value 93", "Value 94", "Value 95"],
|
21
|
+
["Value 96", "Value 97", "Value 98", "Value 99", "Value 100"],
|
22
|
+
];
|
23
|
+
|