|
2 | 2 | /* eslint-disable @typescript-eslint/explicit-function-return-type */ |
3 | 3 | import React, { useEffect, useState } from 'react' |
4 | 4 |
|
5 | | -import { Button, IconOutline, PageDivider } from '~/libs/ui' |
| 5 | +import { Button, IconOutline } from '~/libs/ui' |
6 | 6 |
|
7 | 7 | import { Winning } from '../../models/WinningDetail' |
8 | 8 |
|
@@ -119,62 +119,60 @@ const PaymentsTable: React.FC<PaymentTableProps> = (props: PaymentTableProps) => |
119 | 119 | </table> |
120 | 120 | </div> |
121 | 121 |
|
122 | | - {props.numPages > 1 && ( |
123 | | - <> |
124 | | - <PageDivider /> |
125 | | - <div className={styles.pageButtons}> |
126 | | - <Button |
127 | | - onClick={props.onPreviousPageClick} |
128 | | - secondary |
129 | | - size='md' |
130 | | - icon={IconOutline.ChevronLeftIcon} |
131 | | - iconToLeft |
132 | | - label='PREVIOUS' |
133 | | - disabled={props.currentPage === 1} |
134 | | - /> |
135 | | - {props.currentPage > 3 && <span>...</span>} |
136 | | - <div className={styles.pageNumbers}> |
137 | | - {Array.from(Array(props.numPages) |
138 | | - .keys()) |
139 | | - .filter(pageNumber => { |
140 | | - const currentPage = props.currentPage - 1 |
141 | | - const maxPagesToShow = 5 |
142 | | - const halfMaxPagesToShow = Math.floor(maxPagesToShow / 2) |
143 | | - const startPage = Math.max(currentPage - halfMaxPagesToShow, 0) |
144 | | - const endPage = Math.min(startPage + maxPagesToShow - 1, props.numPages - 1) |
145 | | - |
146 | | - return pageNumber >= startPage && pageNumber <= endPage |
147 | | - }) |
148 | | - .map(pageNumber => ( |
149 | | - <Button |
150 | | - key={`page-${pageNumber}`} |
151 | | - secondary |
152 | | - variant='round' |
153 | | - label={`${pageNumber + 1}`} |
154 | | - onClick={() => props.onPageClick(pageNumber + 1)} |
155 | | - disabled={pageNumber === props.currentPage - 1} |
156 | | - /> |
157 | | - ))} |
158 | | - </div> |
159 | | - {props.currentPage < props.numPages - 2 && <span>...</span>} |
160 | | - <Button |
161 | | - onClick={props.onNextPageClick} |
162 | | - secondary |
163 | | - size='md' |
164 | | - icon={IconOutline.ChevronRightIcon} |
165 | | - iconToRight |
166 | | - label='NEXT' |
167 | | - disabled={props.currentPage === props.numPages} |
168 | | - /> |
169 | | - </div> |
170 | | - </> |
171 | | - )} |
172 | | - |
173 | 122 | <div className={styles.paymentFooter}> |
174 | 123 | <div className={styles.total}> |
175 | 124 | Total: $ |
176 | 125 | {total.toFixed(2)} |
177 | 126 | </div> |
| 127 | + {props.numPages > 1 && ( |
| 128 | + <> |
| 129 | + <div className={styles.pageButtons}> |
| 130 | + <Button |
| 131 | + onClick={props.onPreviousPageClick} |
| 132 | + secondary |
| 133 | + size='md' |
| 134 | + icon={IconOutline.ChevronLeftIcon} |
| 135 | + iconToLeft |
| 136 | + label='PREVIOUS' |
| 137 | + disabled={props.currentPage === 1} |
| 138 | + /> |
| 139 | + {props.currentPage > 3 && <span>...</span>} |
| 140 | + <div className={styles.pageNumbers}> |
| 141 | + {Array.from(Array(props.numPages) |
| 142 | + .keys()) |
| 143 | + .filter(pageNumber => { |
| 144 | + const currentPage = props.currentPage - 1 |
| 145 | + const maxPagesToShow = 5 |
| 146 | + const halfMaxPagesToShow = Math.floor(maxPagesToShow / 2) |
| 147 | + const startPage = Math.max(currentPage - halfMaxPagesToShow, 0) |
| 148 | + const endPage = Math.min(startPage + maxPagesToShow - 1, props.numPages - 1) |
| 149 | + |
| 150 | + return pageNumber >= startPage && pageNumber <= endPage |
| 151 | + }) |
| 152 | + .map(pageNumber => ( |
| 153 | + <Button |
| 154 | + key={`page-${pageNumber}`} |
| 155 | + secondary |
| 156 | + variant='round' |
| 157 | + label={`${pageNumber + 1}`} |
| 158 | + onClick={() => props.onPageClick(pageNumber + 1)} |
| 159 | + disabled={pageNumber === props.currentPage - 1} |
| 160 | + /> |
| 161 | + ))} |
| 162 | + </div> |
| 163 | + {props.currentPage < props.numPages - 2 && <span>...</span>} |
| 164 | + <Button |
| 165 | + onClick={props.onNextPageClick} |
| 166 | + secondary |
| 167 | + size='md' |
| 168 | + icon={IconOutline.ChevronRightIcon} |
| 169 | + iconToRight |
| 170 | + label='NEXT' |
| 171 | + disabled={props.currentPage === props.numPages} |
| 172 | + /> |
| 173 | + </div> |
| 174 | + </> |
| 175 | + )} |
178 | 176 | <Button |
179 | 177 | primary |
180 | 178 | onClick={() => { |
|
0 commit comments