This commit is contained in:
mrfelfel
2026-07-18 19:41:33 +03:30
parent 87ba0d253d
commit dfb0e857f1
158 changed files with 20278 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
import { c as createComponent, d as renderComponent, F as Fragment, r as renderTemplate, b as createAstro, m as maybeRenderHead, a as addAttribute } from './astro/server_DrnzQWw3.mjs';
import 'kleur/colors';
const $$Astro = createAstro();
const $$Pagination = createComponent(($$result, $$props, $$slots) => {
const Astro2 = $$result.createAstro($$Astro, $$props, $$slots);
Astro2.self = $$Pagination;
const { currentPage, totalPages, basePath = "/posts/" } = Astro2.props;
const pages = Array.from({ length: totalPages }, (_, index) => index + 1);
const getPageHref = (page) => page === 1 ? basePath : `${basePath}?page=${page}`;
const previousPage = Math.max(1, currentPage - 1);
const nextPage = Math.min(totalPages, currentPage + 1);
return renderTemplate`${totalPages > 1 && renderTemplate`${renderComponent($$result, "Fragment", Fragment, {}, { "default": ($$result2) => renderTemplate`${maybeRenderHead()}<nav class="flex items-center justify-center gap-1.5 mt-8" aria-label="صفحه‌بندی">${currentPage === 1 ? renderTemplate`<span class="w-9 h-9 rounded-full border border-gray-200 bg-white flex items-center justify-center opacity-40" aria-disabled="true"><span class="material-icons text-base">chevron_right</span></span>` : renderTemplate`<a${addAttribute(getPageHref(previousPage), "href")} class="w-9 h-9 rounded-full border border-gray-200 bg-white flex items-center justify-center transition-colors hover:bg-brand hover:text-white hover:border-brand" aria-label="صفحه قبلی"><span class="material-icons text-base">chevron_right</span></a>`}${pages.map((page) => renderTemplate`<a${addAttribute(getPageHref(page), "href")}${addAttribute(page === currentPage ? "page" : void 0, "aria-current")}${addAttribute([
"w-9 h-9 rounded-full border border-gray-200 flex items-center justify-center text-sm font-medium transition-colors",
page === currentPage ? "bg-brand text-white border-brand" : "bg-white hover:bg-gray-50"
], "class:list")}>${page}</a>`)}${currentPage === totalPages ? renderTemplate`<span class="w-9 h-9 rounded-full border border-gray-200 bg-white flex items-center justify-center opacity-40" aria-disabled="true"><span class="material-icons text-base">chevron_left</span></span>` : renderTemplate`<a${addAttribute(getPageHref(nextPage), "href")} class="w-9 h-9 rounded-full border border-gray-200 bg-white flex items-center justify-center transition-colors hover:bg-brand hover:text-white hover:border-brand" aria-label="صفحه بعدی"><span class="material-icons text-base">chevron_left</span></a>`}</nav><p class="text-center text-xs text-gray-400 mt-2">صفحه ${currentPage} از ${totalPages}</p>` })}`}`;
}, "/Users/drfelfel/ruseemrooz/src/components/Pagination.astro", void 0);
export { $$Pagination as $ };