UNPKG

951 BJavaScriptView Raw
1import React from 'react';
2import PropTypes from 'prop-types';
3import classNames from 'classnames';
4import { mapToCssModules, tagPropType } from './utils';
5
6const propTypes = {
7 /** Set item as active */
8 active: PropTypes.bool,
9 children: PropTypes.node,
10 /** Add custom class */
11 className: PropTypes.string,
12 /** Change underlying component's CSS base class name */
13 cssModule: PropTypes.object,
14 /** Set item as disabled */
15 disabled: PropTypes.bool,
16 /** Set a custom element for this component */
17 tag: tagPropType,
18};
19
20function PaginationItem(props) {
21 const {
22 active,
23 className,
24 cssModule,
25 disabled,
26 tag: Tag = 'li',
27 ...attributes
28 } = props;
29
30 const classes = mapToCssModules(
31 classNames(className, 'page-item', {
32 active,
33 disabled,
34 }),
35 cssModule,
36 );
37
38 return <Tag {...attributes} className={classes} />;
39}
40
41PaginationItem.propTypes = propTypes;
42
43export default PaginationItem;
44
\No newline at end of file