shineout
Version:
Shein 前端组件库
56 lines (46 loc) • 1.52 kB
JavaScript
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
import _defineProperty from "@babel/runtime/helpers/defineProperty";
import React from 'react';
import icons from '../icons';
import Item from './Item';
import { isRTL } from '../config';
var Next =
/*#__PURE__*/
function (_React$PureComponent) {
_inheritsLoose(Next, _React$PureComponent);
function Next() {
return _React$PureComponent.apply(this, arguments) || this;
}
var _proto = Next.prototype;
_proto.renderNext = function renderNext() {
var text = this.props.text;
var rtl = isRTL();
if (rtl) {
return text.prev || icons.AngleLeft;
}
return text.next || icons.AngleRight;
};
_proto.render = function render() {
var _this$props = this.props,
onChange = _this$props.onChange,
current = _this$props.current,
text = _this$props.text,
total = _this$props.total,
pageSize = _this$props.pageSize,
disabled = _this$props.disabled,
isSimple = _this$props.isSimple;
var max = Math.ceil(total / pageSize);
var next = current + 1;
var className = text.next || isSimple ? "no-border arrow" : 'arrow';
return React.createElement(Item, {
className: className,
page: next,
disabled: disabled || next > max,
onClick: onChange
}, this.renderNext());
};
return Next;
}(React.PureComponent);
_defineProperty(Next, "displayName", void 0);
Next.displayName = 'ShineoutPaginationNext';
export default Next;