47 lines
1.6 KiB
JavaScript
47 lines
1.6 KiB
JavaScript
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import classNames from 'classnames';
|
|
import { mapToCssModules, tagPropType } from './utils';
|
|
var propTypes = {
|
|
children: PropTypes.node,
|
|
className: PropTypes.string,
|
|
listClassName: PropTypes.string,
|
|
cssModule: PropTypes.object,
|
|
size: PropTypes.string,
|
|
tag: tagPropType,
|
|
listTag: tagPropType,
|
|
'aria-label': PropTypes.string
|
|
};
|
|
var defaultProps = {
|
|
tag: 'nav',
|
|
listTag: 'ul',
|
|
'aria-label': 'pagination'
|
|
};
|
|
|
|
var Pagination = function Pagination(props) {
|
|
var _classNames;
|
|
|
|
var className = props.className,
|
|
listClassName = props.listClassName,
|
|
cssModule = props.cssModule,
|
|
size = props.size,
|
|
Tag = props.tag,
|
|
ListTag = props.listTag,
|
|
label = props['aria-label'],
|
|
attributes = _objectWithoutPropertiesLoose(props, ["className", "listClassName", "cssModule", "size", "tag", "listTag", "aria-label"]);
|
|
|
|
var classes = mapToCssModules(classNames(className), cssModule);
|
|
var listClasses = mapToCssModules(classNames(listClassName, 'pagination', (_classNames = {}, _classNames["pagination-" + size] = !!size, _classNames)), cssModule);
|
|
return React.createElement(Tag, {
|
|
className: classes,
|
|
"aria-label": label
|
|
}, React.createElement(ListTag, _extends({}, attributes, {
|
|
className: listClasses
|
|
})));
|
|
};
|
|
|
|
Pagination.propTypes = propTypes;
|
|
Pagination.defaultProps = defaultProps;
|
|
export default Pagination; |