"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Page;

var _propTypes = _interopRequireDefault(require("prop-types"));

var _Button = _interopRequireDefault(require("../Button/Button"));

var _react = _interopRequireDefault(require("react"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function Page(_ref) {
  var href = _ref.href,
      index = _ref.index,
      isActive = _ref.isActive,
      onPageChange = _ref.onPageChange;
  return /*#__PURE__*/_react.default.createElement("li", null, isActive ? /*#__PURE__*/_react.default.createElement("span", {
    className: "ds-c-button ds-c-button--ghost ds-c-pagination__current-page",
    "aria-current": "true"
  }, index) : /*#__PURE__*/_react.default.createElement(_Button.default, {
    variation: "ghost",
    href: href,
    onClick: onPageChange,
    "aria-label": "page ".concat(index)
  }, index));
}

Page.propTypes = {
  /**
     * Defines the page number.
     */
  index: _propTypes.default.number.isRequired,

  /**
     * Renders current page if true, other links if false.
     */
  isActive: _propTypes.default.bool.isRequired,

  /**
     * A callback function used to handle state changes.
     */
  onPageChange: _propTypes.default.func,

  /**
     * Defines application-specific routing in url for links.
     */
  href: _propTypes.default.string.isRequired
};