2 lines
2.7 KiB
JavaScript
2 lines
2.7 KiB
JavaScript
import{j as e}from"./vendor-query-a3e439f2.js";import{B as r}from"./index-590deac5.js";import{w as a,e as s}from"./vendor-ui-8a3c5c7d.js";const t=({currentPage:t,totalPages:d,onPageChange:i,itemsPerPage:n,totalItems:l})=>{const o=(t-1)*n+1,m=Math.min(t*n,l);return d<=1?null:e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 bg-white dark:bg-gray-800 border-t border-gray-200 dark:border-gray-700 sm:px-6",children:[e.jsxs("div",{className:"flex flex-1 justify-between sm:hidden",children:[e.jsx(r,{variant:"secondary",size:"sm",onClick:()=>i(t-1),disabled:1===t,children:"قبلی"}),e.jsx(r,{variant:"secondary",size:"sm",onClick:()=>i(t+1),disabled:t===d,children:"بعدی"})]}),e.jsxs("div",{className:"hidden sm:flex sm:flex-1 sm:items-center sm:justify-between",children:[e.jsx("div",{children:e.jsxs("p",{className:"text-sm text-gray-700 dark:text-gray-300",children:["نمایش ",e.jsx("span",{className:"font-medium",children:o})," تا"," ",e.jsx("span",{className:"font-medium",children:m})," از"," ",e.jsx("span",{className:"font-medium",children:l})," نتیجه"]})}),e.jsx("div",{children:e.jsxs("nav",{className:"relative z-0 inline-flex rounded-md shadow-sm -space-x-px",children:[e.jsx("button",{onClick:()=>i(t-1),disabled:1===t,className:"relative inline-flex items-center px-2 py-2 rounded-r-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-sm font-medium text-gray-500 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-600 disabled:opacity-50 disabled:cursor-not-allowed",children:e.jsx(a,{className:"h-5 w-5"})}),(()=>{const e=[];if(d<=5)for(let r=1;r<=d;r++)e.push(r);else{const r=Math.max(1,t-2),a=Math.min(d,r+5-1);for(let s=r;s<=a;s++)e.push(s);r>1&&(e.unshift("..."),e.unshift(1)),a<d&&(e.push("..."),e.push(d))}return e})().map((r,a)=>e.jsx("button",{onClick:()=>"number"==typeof r&&i(r),disabled:"..."===r,className:"relative inline-flex items-center px-4 py-2 border text-sm font-medium "+(r===t?"z-10 bg-primary-50 dark:bg-primary-900 border-primary-500 text-primary-600 dark:text-primary-400":"..."===r?"border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-300 cursor-default":"border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-500 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-600"),children:r},a)),e.jsx("button",{onClick:()=>i(t+1),disabled:t===d,className:"relative inline-flex items-center px-2 py-2 rounded-l-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-sm font-medium text-gray-500 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-600 disabled:opacity-50 disabled:cursor-not-allowed",children:e.jsx(s,{className:"h-5 w-5"})})]})})]})]})};export{t as P};
|