hezarfen_frontend
Clone
https://git.tahinli.com/archive/hezarfen_frontend.git
0 watching0 forksTypeScript5.5 MiBdcf123aBurak Boduroğlu2 months ago674 commits
| 1 | import { Button } from "@/components/ui/button"; |
| 2 | import { IconChevronLeft, IconChevronRight } from "@/components/ui/icons"; |
| 3 | import { useT } from "@/stores/preferences-context"; |
| 4 | |
| 5 | export function PaginationControls(props: { |
| 6 | page: number; |
| 7 | totalPages: number; |
| 8 | onPageChange: (page: number) => void; |
| 9 | }) { |
| 10 | const t = useT(); |
| 11 | return ( |
| 12 | <div class="flex items-center justify-between gap-2 border-t border-border/60 pt-3"> |
| 13 | <Button |
| 14 | type="button" |
| 15 | variant="outline" |
| 16 | size="sm" |
| 17 | class="h-8 gap-1 px-3" |
| 18 | disabled={props.page <= 0} |
| 19 | onClick={() => props.onPageChange(Math.max(0, props.page - 1))} |
| 20 | > |
| 21 | <IconChevronLeft class="h-3.5 w-3.5" /> |
| 22 | {t("common.prev")} |
| 23 | </Button> |
| 24 | <span class="text-xs tabular-nums text-muted-foreground"> |
| 25 | {t("common.pageOf", { page: props.page + 1, total: props.totalPages })} |
| 26 | </span> |
| 27 | <Button |
| 28 | type="button" |
| 29 | variant="outline" |
| 30 | size="sm" |
| 31 | class="h-8 gap-1 px-3" |
| 32 | disabled={props.page >= props.totalPages - 1} |
| 33 | onClick={() => props.onPageChange(Math.min(props.totalPages - 1, props.page + 1))} |
| 34 | > |
| 35 | {t("common.next")} |
| 36 | <IconChevronRight class="h-3.5 w-3.5" /> |
| 37 | </Button> |
| 38 | </div> |
| 39 | ); |
| 40 | } |