36 lines
1.2 KiB
TypeScript
36 lines
1.2 KiB
TypeScript
// * Other
|
|
import { Paginator } from "@/back/types/global";
|
|
import PaginationCustom from "@/back/Components/Pagination/PaginationCustom";
|
|
import PaginationPerPage from "@/back/Components/Pagination/PaginationPerPage";
|
|
import useTrans from "@/hooks/use-translations";
|
|
|
|
export default function PaginationWrapper({
|
|
modelsPaginate,
|
|
}: {
|
|
modelsPaginate: Paginator;
|
|
}) {
|
|
const GetTranslation = () => {
|
|
return useTrans(
|
|
"pagination.informations",
|
|
{
|
|
total: String(modelsPaginate.total),
|
|
page: String(modelsPaginate.last_page),
|
|
},
|
|
modelsPaginate.last_page > 1 ? 2 : 1,
|
|
);
|
|
};
|
|
return (
|
|
modelsPaginate.total > 1 && (
|
|
<div className="flex flex-col xl:flex-row justify-between items-center mt-4">
|
|
<PaginationPerPage
|
|
perPage={modelsPaginate.per_page}
|
|
total={modelsPaginate.total}
|
|
/>
|
|
<p className="text-sm text-muted-foreground my-2 xl:mb-0">
|
|
{GetTranslation()}
|
|
</p>
|
|
<PaginationCustom links={modelsPaginate.links} />
|
|
</div>
|
|
)
|
|
);
|
|
}
|