UNPKG

@kiwicom/orbit-components

Version:

Orbit-components is a React component library which provides developers with the easiest possible way of building Kiwi.com’s products.

26 lines (24 loc) 910 B
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray"; import * as React from "react"; import ActiveButton from "./ActiveButton"; import PageButtonLink from "./PageButtonLink"; var Pages = function Pages(_ref) { var pageCount = _ref.pageCount, selectedPage = _ref.selectedPage, onPageChange = _ref.onPageChange, _ref$enlargement = _ref.enlargement, enlargement = _ref$enlargement === void 0 ? 1 : _ref$enlargement, size = _ref.size; return Array.apply(void 0, _toConsumableArray(Array(pageCount))).map(function (_, index) { var key = index + enlargement; return selectedPage === key ? /*#__PURE__*/React.createElement(ActiveButton, { key: key, size: size }, key) : /*#__PURE__*/React.createElement(PageButtonLink, { key: key, onPageChange: onPageChange, size: size }, key); }); }; export default Pages;