UNPKG

phx-react

Version:

PHX REACT

31 lines 1.53 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const react_1 = tslib_1.__importStar(require("react")); const Dropdown_1 = require("../Dropdown"); const optionNumber = [150, 125, 100, 75, 50, 25, 10]; function PaginationSelected({ rowQuantity, setCurrentPage, setRowQuantity, router }) { const [searchParams, setSearchParams] = (0, react_1.useState)({}); (0, react_1.useEffect)(() => { if (typeof window !== 'undefined') { const params = new URLSearchParams(window.location.search); setSearchParams(params); } }, []); const options = optionNumber.map((item) => ({ content: item + '', active: rowQuantity === item, onClick: () => { setRowQuantity(item); setCurrentPage(1); const params = new URLSearchParams(searchParams + ''); params.set('row', item + ''); router === null || router === void 0 ? void 0 : router.push(`?${params + ''}`, { scroll: false }); }, })); return (react_1.default.createElement("div", { className: 'flex items-center ' }, react_1.default.createElement(Dropdown_1.PHXDropdown, { buttonContent: `${rowQuantity}`, options: options, origin: 'top-left', type: 'default' }), react_1.default.createElement("span", { className: 'mx-1 whitespace-nowrap text-xs' }, "b\u1EA3n ghi/trang"))); } exports.default = PaginationSelected; //# sourceMappingURL=PaginaitonSelected.js.map