({
page,
totalPages,
onPageChange,
disabled,
}: EntityPaginationProps)
| 139 | }; |
| 140 | |
| 141 | export const EntityPagination = ({ |
| 142 | page, |
| 143 | totalPages, |
| 144 | onPageChange, |
| 145 | disabled, |
| 146 | }: EntityPaginationProps) => { |
| 147 | return ( |
| 148 | <div className="flex items-center justify-between gap-x-2 w-full"> |
| 149 | <div className="flex-1 text-sm text-muted-foreground"> |
| 150 | Page {page} of {totalPages || 1} |
| 151 | </div> |
| 152 | <div className="flex items-center justify-end space-x-2 py-4"> |
| 153 | <Button |
| 154 | disabled={page === 1 || disabled} |
| 155 | variant="outline" |
| 156 | size="sm" |
| 157 | onClick={() => onPageChange(Math.max(1, page - 1))} |
| 158 | > |
| 159 | Previous |
| 160 | </Button> |
| 161 | <Button |
| 162 | disabled={page === totalPages || totalPages === 0 || disabled} |
| 163 | variant="outline" |
| 164 | size="sm" |
| 165 | onClick={() => onPageChange(Math.min(totalPages, page + 1))} |
| 166 | > |
| 167 | Next |
| 168 | </Button> |
| 169 | </div> |
| 170 | </div> |
| 171 | ) |
| 172 | }; |
| 173 | |
| 174 | interface StateViewProps { |
| 175 | message?: string; |
nothing calls this directly
no outgoing calls
no test coverage detected