Skip to content

Commit 3766dae

Browse files
committed
Fixed pagination in table
1 parent 7f176f8 commit 3766dae

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/components/Table/index.jsx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ const Table = ({ columns, data }) => {
2222
nextPage,
2323
setPageSize,
2424
canPreviousPage,
25-
canNextPage
25+
canNextPage,
2626
} = useTable(
2727
{
2828
columns,
29-
data
29+
data,
3030
},
3131
useSortBy,
3232
usePagination
@@ -41,9 +41,9 @@ const Table = ({ columns, data }) => {
4141
{...getTableProps()}
4242
>
4343
<thead>
44-
{headerGroups.map(headerGroup => (
44+
{headerGroups.map((headerGroup) => (
4545
<tr {...headerGroup.getHeaderGroupProps()}>
46-
{headerGroup.headers.map(column => (
46+
{headerGroup.headers.map((column) => (
4747
<th
4848
className={classNames(
4949
{ [classes.isCurrentSort]: column.isSorted },
@@ -72,18 +72,18 @@ const Table = ({ columns, data }) => {
7272
))}
7373
</thead>
7474
<tbody {...getTableBodyProps()}>
75-
{page.map(row => {
75+
{page.map((row) => {
7676
prepareRow(row);
7777
return (
7878
<tr {...row.getRowProps()}>
79-
{row.cells.map(cell => {
79+
{row.cells.map((cell) => {
8080
return (
8181
<td
8282
className={classNames(
8383
{ 'is-actions-cell': cell.column.id === 'actions' },
8484
{
8585
'has-no-head-mobile is-image-cell':
86-
cell.column.id === 'logoUrl'
86+
cell.column.id === 'logoUrl',
8787
}
8888
)}
8989
data-label={cell.column.Header}
@@ -104,11 +104,11 @@ const Table = ({ columns, data }) => {
104104
<span className="select">
105105
<select
106106
value={pageSize}
107-
onChange={e => {
107+
onChange={(e) => {
108108
setPageSize(Number(e.target.value));
109109
}}
110110
>
111-
{[5, 10, 15, 20, 50].map(size => (
111+
{[5, 10, 15, 20, 50].map((size) => (
112112
<option key={size} value={size}>
113113
{size} {perPage}
114114
</option>
@@ -162,7 +162,7 @@ const Table = ({ columns, data }) => {
162162
<button
163163
type="button"
164164
className="pagination-link"
165-
onClick={() => gotoPage(2)}
165+
onClick={() => gotoPage(1)}
166166
>
167167
2
168168
</button>
@@ -207,7 +207,7 @@ const Table = ({ columns, data }) => {
207207
<button
208208
type="button"
209209
className="pagination-link"
210-
onClick={() => gotoPage(pageCount - 1)}
210+
onClick={() => gotoPage(pageCount - 2)}
211211
>
212212
{pageCount - 1}
213213
</button>
@@ -246,9 +246,9 @@ Table.propTypes = {
246246
Cell: PropTypes.func,
247247
sortType: PropTypes.string,
248248
id: PropTypes.string,
249-
disableSortBy: PropTypes.bool
249+
disableSortBy: PropTypes.bool,
250250
})
251-
).isRequired
251+
).isRequired,
252252
};
253253

254254
export default Table;

0 commit comments

Comments
 (0)