UNPKG

@wordpress/components

Version:
23 lines (22 loc) • 912 B
import { __, sprintf } from "@wordpress/i18n"; import Button from "../button/index.mjs"; import { PageControlIcon } from "./icons.mjs"; import { jsx } from "react/jsx-runtime"; // packages/components/src/guide/page-control.tsx function PageControl({ currentPage, numberOfPages, setCurrentPage }) { return /* @__PURE__ */ jsx("ul", { className: "components-guide__page-control", "aria-label": __("Guide controls"), children: Array.from({ length: numberOfPages }).map((_, page) => /* @__PURE__ */ jsx("li", { "aria-current": page === currentPage ? "step" : void 0, children: /* @__PURE__ */ jsx(Button, { size: "small", icon: /* @__PURE__ */ jsx(PageControlIcon, {}), "aria-label": sprintf(__("Page %1$d of %2$d"), page + 1, numberOfPages), onClick: () => setCurrentPage(page) }, page) }, page)) }); } export { PageControl as default }; //# sourceMappingURL=page-control.mjs.map